From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by sourceware.org (Postfix) with ESMTPS id 04E683858C60 for ; Tue, 7 Dec 2021 16:03:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 04E683858C60 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MF39M-1mo5Uo2GOu-00FREh for ; Tue, 07 Dec 2021 17:03:46 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id DDC3CA80A6B; Tue, 7 Dec 2021 17:03:44 +0100 (CET) Date: Tue, 7 Dec 2021 17:03:44 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: vboxsharedfs - Too many levels of symbolic links Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20211205115411.1619911cb3e2d23f671912ce@nifty.ne.jp> <20211206195527.9b9c09b549fa8fcc2512949e@nifty.ne.jp> <20211207094612.313345b38eac94bae85448b4@nifty.ne.jp> <20211208003249.0901c94003421c1d1c06169c@nifty.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211208003249.0901c94003421c1d1c06169c@nifty.ne.jp> X-Provags-ID: V03:K1:EkWWdg+00EXN8O8Mb1t75XZHUbn14p05QmLNZLSn0ME7Jtn5IJx D1CDFCO/QIdHHXzGKMpQe5CycmeIjIPYYeGBH2HnvaKXJU2dvLygvc6c0jxWRqy7gmpiGbo oLD+ghybPtTOG61/9R5JpNL/bzhO5/4vmy5mYspjMEX5v1nhC31DWL3KJ6LfYD8jt7t0HeE JBnT9qNU6+Gd0sWO9Hi1Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:Dkqh8fQpuT4=:2sT42CyIXieAz2I+pJa2uN Vcz+rG17DZYypdiSZi8Z1pLDCXurWbkuU+EICXZyJrbKidzTvyqUFI1eT1N76tdtC2xuX0hp2 sN7npFxjWTzimfm88o+xuHj7kh5CL+V0zbmFUIMhYq8NuSmkjFHsegbY3mFxunyhs9dugEjI1 aM4tmQi8wV1hdccqHroFt96qXYnPtZCsfnsiKFg+HP6xhfTb6LJO3SL+yTpfP7j318IAr7lLw Xmbj6EHyeuaHwTrROaCMFmW9+vA2mxNGw49fXq7IgbodOfLp9LkYx2Y1LnH6PYQb6I7NIt/Gb Qoy5RniY1pmb73Yx8wl7v3lO3iUA5NoYyJBLiZeAX/0wXMcSHSpsYb9NaC48sWphcijhM2Uzk /BmpGLIemvTPf7GdKJzYmt2YBbGrhOTH/7M1mHkG4oD3RSm3/RATLSlvNHLuzTB0FKLynESVE 9vwlc4bNypocBYBSHdwd7ZOnaXQZ6y8g6XhiLELy6r145LM+Z7eG9tnmV01bjZe08N5LQa+79 F1XRcTLxP5eLpgXq2nixU5F0thtxRJYndWSypYiRJTNidjzU4w53uMMiIZOAHyxnMOUdwfQot Rnycz4TfvhKqbmUdn1M6v06SLmlkBVj+OZDowrGQMlu+DNWcPYRgiT+xth5douixiH1sDFtwo L+95H448TU6Sj7Qno8/tAcU4P2IMDUXjbx+ocxXXx0WSthV00R0Azok3DXSL+Ri61hF5imgoC hnywA5qR+/fjMLMc X-Spam-Status: No, score=-99.4 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, 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@cygwin.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: , X-List-Received-Date: Tue, 07 Dec 2021 16:03:50 -0000 On Dec 8 00:32, Takashi Yano wrote: > On Tue, 7 Dec 2021 15:57:56 +0100 > Corinna Vinschen wrote: > > On Dec 7 09:46, Takashi Yano wrote: > > > I think '/cygdrive/z/..' should be '/cygdrive', however, > > > in current cygwin, it is interpreted into '//VBoxSrv'. > > > > > > Is this as you intended? > > > > > > With my patch which stops to treat UNC path as symlink, > > > '/cygdrive/z/..' returns '/cygdrive'. > > > > Yeah, but... > > > > ...what bugs me is that *every* UNC path is treated this way with > > that patch. If you have a path like /cygdrive/x/a/b/c, with x: > > being a virtual drive pointing to //server/share, and with "b" > > being a symlink to "syml", what you get back is either > > > > //server/share/a/syml/c > > > > without, or > > > > /cygdrive/x/a/b/c > > > > with your patch. What we would like to get back is > > > > /cygdrive/x/a/syml/c > > With my patch, above case behaves like: > > $ mount > C:/cygwin/bin on /usr/bin type ntfs (binary,auto) > C:/cygwin/lib on /usr/lib type ntfs (binary,auto) > C:/cygwin on / type ntfs (binary,auto) > C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto) > D: on /cygdrive/d type iso9660 (binary,posix=0,user,noumount,auto) > Z: on /cygdrive/z type vboxsharedfolderfs (binary,posix=0,user,noumount,auto) > $ cd /cygdrive/z > $ mkdir -p aa/syml/cc > $ ln -s syml aa/bb > $ cd aa/bb/cc > $ /bin/pwd > /cygdrive/z/aa/syml/cc > $ > > Isn't this what you would like? Sorry, I wasn't expressing myself clearly. The end result is what is expected, yes. But that's the result of the full path_conv conversion, which wasn't what I was up to. The idea of the GFPNBH call is to short-circuit the path_conv handling in case we have native Windows symlinks in the path. My example above was only considering what comes out of the `if ((pc_flags & ...) { ... } ' expression starting in line 3485 (assuming "b" is a native symlink). What I mean is this: Your patch disregards the entire string returned by GFPNBH, if the returned path is an UNC path, no matter what. But what if the incoming path already *was* an UNC path, and potentially contains native symlinks? In that case you have no reason to disregard the resulting path from GFPNBH. And if it was a drive letter path, wouldn't it be nicer to just convert the UNC path prefix back to the drive letter and keep the rest of the final path intact? However, both of these scenarios require extra code, which isn't that important for now, so, never mind. Corinna