X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E69C3858003
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1638893097;
	bh=H+Mfy/9dWUlVvwSsmfniO1/SAH4FjVzJFbAfIUByIMU=;
	h=Date:From:To:Subject:References:In-Reply-To:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 Reply-To:From;
	b=mD1pcnudHIR+BYjv0lri/4Obapt74fx4JH3sJ8foW1Lw23KcT09fbeji450qEdaIW
	 E8oTYSswkjpEqYFAF+2B1nmFKOjN94OCyDuNlirFOA6bSwWHGEqSK/bFWTkj9DSBUf
	 O4xb0CsrKMU2XBLpyXsL0h9z08kXVAOJMHqSwjK8=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
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
Date: Tue, 7 Dec 2021 17:03:44 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: vboxsharedfs - Too many levels of symbolic links
Message-ID: <Ya+F4JnYkOaAZXPP@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <d6470ffe-8e49-3eb7-4d21-3212e0ad4f31@oskog97.com>
 <20211205115411.1619911cb3e2d23f671912ce@nifty.ne.jp>
 <Ya3i/sfWB2avaJ9F@calimero.vinschen.de>
 <20211206195527.9b9c09b549fa8fcc2512949e@nifty.ne.jp>
 <20211207094612.313345b38eac94bae85448b4@nifty.ne.jp>
 <Ya92dHe+1fq5CvXA@calimero.vinschen.de>
 <20211208003249.0901c94003421c1d1c06169c@nifty.ne.jp>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <20211208003249.0901c94003421c1d1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+/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 <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Reply-To: cygwin@cygwin.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

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

-- 
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
