public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Fwd: vboxsharedfs - Too many levels of symbolic links
       [not found] <82f94b97-26fe-516a-72c3-3090c6849082@oskog97.com>
@ 2021-12-05 10:36 ` Oskar Skog
  0 siblings, 0 replies; only message in thread
From: Oskar Skog @ 2021-12-05 10:36 UTC (permalink / raw)
  To: cygwin

On 2021-12-05 04:54, Takashi Yano wrote:
> In 64bit Windows10, for vbox shared path, GetFinalPathNameByHandleW()
> returns path with trailing '\'. As a result, RtlEqualUnicodeString()
> fails and tries to resolve symlink repeatedly.
> 
> For example, RtlEqualUnicodeString() compares \??\UNC\VBoxSrv\tmp and
> \??\UNC\VBoxSrv\tmp\, then it fails.
> 
> This does not happen in 32bit Windows10. It seems that UNC path is not
> treated as a symlink in 32bit Windows10. I am not sure why.
> 
> Therefore, I have applied a patch which stops to treat UNC path as a
> symlink for testing as follows.
> 
> diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
> index baf04ce89..31a96ca58 100644
> --- a/winsup/cygwin/path.cc
> +++ b/winsup/cygwin/path.cc
> @@ -3490,6 +3490,9 @@ restart:
>   	  ret = GetFinalPathNameByHandleW (h, fpbuf, NT_MAX_PATH, 0);
>   	  if (ret)
>   	    {
> +	      if (wcsstr (fpbuf, L"\\\\?\\UNC\\") == fpbuf)
> +		goto file_not_symlink;
> +
>   	      UNICODE_STRING fpath;
>   
>   	      RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR));
> 
> I have confirmed this patch fixes the issue. In addition, this patch
> also resolves the issue:
> https://cygwin.com/pipermail/cygwin/2021-December/250103.html
> 
> Is this the right thing?
> 
> -- Takashi Yano


I can confirm that the patch fixes the issue with VirtualBox shared
folders.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-05 10:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <82f94b97-26fe-516a-72c3-3090c6849082@oskog97.com>
2021-12-05 10:36 ` Fwd: vboxsharedfs - Too many levels of symbolic links Oskar Skog

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).