From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by sourceware.org (Postfix) with ESMTPS id 080273858D28 for ; Wed, 8 Dec 2021 10:37:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 080273858D28 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 1N3sZs-1mUTRg0REG-00znwK for ; Wed, 08 Dec 2021 11:37:44 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id DF234A80D32; Wed, 8 Dec 2021 11:37:39 +0100 (CET) Date: Wed, 8 Dec 2021 11:37:39 +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: <20211208172008.01b11239c374604abf638a19@nifty.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211208172008.01b11239c374604abf638a19@nifty.ne.jp> X-Provags-ID: V03:K1:naXLOUaNLIEvTYkzVBBcwvyy7+BZMTj1X9OC6T7KBsuT0h+/F8T qnByBctPu5Y7DNPXmYdnIfqRf13VhYdAarNbat8NwV/Mb0Q6GuiP0ON0SN0zTN2ufjUaOdw i7qwFpM0wwpGWRstCgVqyB4uvFS0yKkbWq6nN/rwXAZ3THudWD6P/e/D9xnaRC3Mmer5xSq HhZGTCc6bXzVIHHqrDplg== X-UI-Out-Filterresults: notjunk:1;V03:K0:CZWP6kRHw7s=:NN5tlS8PafHtsG0E7ymb14 AghgjGa/apJxeRYvwR2HCi4y+ykh/fkQ7rux2C9rALrmq/9JSYHltulhKLRovv8qlLweVe9Ek VtSjlHccv0BShTpa20xtCG0BEE5AY/nGhAwoREkeJPybZBVZPRlNxHqoJB8iqpJtwpfbR11ij x3azmlBAObGXqQvIQuuRLDP4JibFGJx1S4AU7Zb3A/GJAX4pqcnxjmANMPg+QsdYaiSyf2WzL i3i1UmSWChnMoDJN8EDF9tnkuLZ3mStGS1HFdRqnXLUIkzFePt6WUvAOm62oRD1bo+cIFQa7j 9HFaK4AWGQgDlmLfTPEdlokjlbKlFgn3bzz89RiGKHatJ7q7kQZRKH1QqgyOKqXkYu4Zc/yCl U+wZl8XxBdInVXm9bJbeFIU+Xog+mZgPFoO04/shrppQsTEu1r5o0GRdkkHxR9vE6uw5gt13A VKL+rk3Rh0j0Wa3RzUhZFvcG1G9A6IRafqp+hhKHUEM7lEyx0EqUP07B1T627ZuKQWYsBDtnB 5YIZFeP0+q+xk4m1Np4mxpMRFi9hi8R1k75Ter2ydXs0gCWsFJc0h3YiCgEMhcq6Of+fJDzay ++FWaQobFGyz9DUBVSaiKs8+nabBOwspdRkRM06o1ZEOQ24QCqo71OV/2lK+M0XN/+T7NRF1j uQ2tRi0/7Cq7ZtQmGKh9EFvD+hGzcXgF/FiEuHbUyw3lOBc8KG/KvwXTMiyjlvfObZuAQfi6m FQoZ7ueXJnDoIDgt 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_H4, RCVD_IN_MSPIKE_WL, 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: Wed, 08 Dec 2021 10:37:47 -0000 On Dec 8 17:20, Takashi Yano wrote: > On Tue, 7 Dec 2021 18:15:42 +0100 > Corinna Vinschen wrote: > > Hi Takashi, > > > > ----- Forwarded message from Corinna Vinschen ----- > > > 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. > > ----- End forwarded message ----- > > > > What I meant is something like the below (entirely untested). Yeah, I'm > > not sure myself, if it's worth the effort... > > [...] > I confirmed that your patch works nicely. > > ...except when the drive is created by subst using UNC path, > e.g. subst w: \\server\share. > > In this case, WNetGetConnectionW() fails with ERROR_NO_NET_OR_BAD_PATH. > > So, I modified your patch a bit. > > What about attached patch? Oh, great! GetVolumePathNameW is the function I somehow missed when looking into the Microsoft docs yesterday, so thanks for modifying the patch this way. Please push. Corinna