public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Oskar Skog <novia@oskog97.com>
To: cygwin@cygwin.com
Subject: Re: vboxsharedfs - Too many levels of symbolic links
Date: Sun, 5 Dec 2021 16:49:13 +0200	[thread overview]
Message-ID: <36be1c59-efd1-5cfb-93c1-baf629a897dc@oskog97.com> (raw)
In-Reply-To: <20211205115411.1619911cb3e2d23f671912ce@nifty.ne.jp>

On 2021-12-05 04:54, Takashi Yano wrote:
> On Tue, 30 Nov 2021 19:04:57 +0200
> Oskar Skog wrote:
>> vboxsharedfs file systems no longer work. Any attempt to access will
>> result in "too many levels of symbolic links".
>>
>> This only affects the VirtualBox shared folder, the Samba share works
>> just fine.
....
> 
> I tested with VirtualBox version 6.1.30.
> 
> 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?
> 


I have tested the patch and it is now possible to access /cygdrive/z
again.


But if I create a symlink on that filesystem, it's not identified as a
symlink. Although, I don't know if this has ever worked as it is the
first time I've ever tested it, it probably hasn't ever worked (see
below).

user@DESKTOP-******* /cygdrive/z$ ln -s report.pdf test.pdf
user@DESKTOP-******* /cygdrive/z$ ls -l report.pdf test.pdf
-rw-r--r-- 1 user None 1454562 Nov 28 12:05 report.pdf
-rw-r--r-- 1 user None      34 Dec  5 16:36 test.pdf
user@DESKTOP-******* /cygdrive/z$ cat test.pdf
!<symlink>▒▒report.pdfuser@DESKTOP-******* /cygdrive/z$

I think it's because "special" attributes don't work on VirtualBox
shared folders, I can't hide files in Explorer either.

So I don't think the patch has caused any regression here.

The samba share (Y:) works, just as it did before, symlinks work too.



(Sorry about the previous mail, I apparently suck at email.)

  reply	other threads:[~2021-12-05 14:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 17:04 Oskar Skog
2021-11-30 21:40 ` Gackle, Philip P
2021-12-02 10:43 ` Corinna Vinschen
2021-12-05  2:54 ` Takashi Yano
2021-12-05 14:49   ` Oskar Skog [this message]
2021-12-06  3:31     ` Takashi Yano
2021-12-06  6:34       ` Oskar Skog
2021-12-06  8:04       ` Takashi Yano
2021-12-06 10:16   ` Corinna Vinschen
2021-12-06 10:55     ` Takashi Yano
2021-12-07  0:46       ` Takashi Yano
2021-12-07 14:57         ` Corinna Vinschen
2021-12-07 15:32           ` Takashi Yano
2021-12-07 15:43             ` Takashi Yano
2021-12-07 16:03             ` Corinna Vinschen
     [not found] <Ya+WvmECA+zAbuV9@calimero.vinschen.de>
2021-12-08  8:20 ` Takashi Yano
2021-12-08 10:37   ` Corinna Vinschen
2021-12-09  8:16     ` Takashi Yano
2021-12-09  9:16       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36be1c59-efd1-5cfb-93c1-baf629a897dc@oskog97.com \
    --to=novia@oskog97.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).