X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 160F43858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=oskog97.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oskog97.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oskog97.com; s=gm1; t=1638715755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EK/8AZx5WfrDrnLZv4KInHJHU+8bZAhxv8HrJb/+9pg=; b=dt8qFe+H7kytIpTTx61E6a9MAJs9Uz0hz8cu6t0sI0jYF+TSyQlb+TcnadLNstV9FBnoHf t9PF2OaS5Q4rCeURtO05nZYr9joULM4HlzUQ5enl9/pM00KIIQK63ErAlV9h4+8w2p2USm KC+qGToCagNMeTItpbOgC1yO2R6mgse7oDPaN5D6jU0PpekL/GYlbYA/rgJamuM7t9YgDG xY1N1q6c+bGj5H7dxXH7G44W1W0UA2IRTqYVhdNeeufwr06JxMU9KlFyZ0pmFC3jDFls8H hYhWLJEwKRpLlOsMN4+P6HID6CFidBrTLBEKiVgEcETqMY4CcqokWV4O4qfqRw== Subject: Re: vboxsharedfs - Too many levels of symbolic links To: cygwin AT cygwin DOT com References: <20211205115411 DOT 1619911cb3e2d23f671912ce AT nifty DOT ne DOT jp> From: Oskar Skog Message-ID: <36be1c59-efd1-5cfb-93c1-baf629a897dc@oskog97.com> Date: Sun, 5 Dec 2021 16:49:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211205115411.1619911cb3e2d23f671912ce@nifty.ne.jp> Content-Language: en-US X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 1B5EnZ3k009762 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 AT DESKTOP-******* /cygdrive/z$ ln -s report.pdf test.pdf user AT 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 AT DESKTOP-******* /cygdrive/z$ cat test.pdf !▒▒report DOT pdfuser AT 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.) -- 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