vboxsharedfs - Too many levels of symbolic links
Sun Dec 5 14:49:13 GMT 2021
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:
> Is this the right thing?
I have tested the patch and it is now possible to access /cygdrive/z
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
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
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.)
More information about the Cygwin