On Mon, 6 Dec 2021 11:16:30 +0100 Corinna Vinschen wrote: > > For example, RtlEqualUnicodeString() compares \??\UNC\VBoxSrv\tmp and > > \??\UNC\VBoxSrv\tmp\, then it fails. > > [...] > > + if (wcsstr (fpbuf, L"\\\\?\\UNC\\") == fpbuf) > > + goto file_not_symlink; > > + > > Isn't that a bit intrusive? Wouldn't it also fix the issue if we > just overwrite a trailing '\\' with '\0', like this? > > diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc > index baf04ce89a08..b76e5b0466cf 100644 > --- a/winsup/cygwin/path.cc > +++ b/winsup/cygwin/path.cc > @@ -3492,8 +3492,14 @@ restart: > { > UNICODE_STRING fpath; > > - RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR)); > + /* If incoming path has no trailing backslash, but final path > + has one, drop trailing backslash from final path so the > + below string comparison has a chance to succeed. */ > + if (upath.Buffer[(upath.Length - 1) / sizeof (WCHAR)] != L'\\' > + && fpbuf[ret - 1] == L'\\') > + fpbuf[--ret] = L'\0'; > fpbuf[1] = L'?'; /* \\?\ --> \??\ */ > + RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR)); > if (!RtlEqualUnicodeString (&upath, &fpath, !!ci_flag)) > { > issymlink = true;
First, I think the same. However, with this patch, it sometimes causes hang for a few seconds around the code: else if (isvirtual_dev (dev)) { /* FIXME: Calling build_fhandler here is not the right way to handle this. */ fhandler_virtual *fh = (fhandler_virtual *) build_fh_dev (dev, path_copy); virtual_ftype_t file_type; if (!fh) file_type = virt_none; else { file_type = fh->exists (); if (file_type == virt_symlink || file_type == virt_fdsymlink) { fh->fill_filebuf (); symlen = sym.set (fh->get_filebuf ()); } with path_copy of "//VBoxSrv". I am not sure why. In addition, https://cygwin.com/pipermail/cygwin/2021-December/250103.html still needs fix. So I proposed the patch which stops to treat UNC path as symlink. -- Takashi Yano <takashi.y...@nifty.ne.jp> -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple