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 59E243858D35 for ; Mon, 12 Dec 2022 13:09:52 +0000 (GMT) Authentication-Results: sourceware.org; dmarc=permerror header.from=cygwin.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N32y5-1owuep43vp-013NXG; Mon, 12 Dec 2022 14:09:51 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id 7916AA80A38; Mon, 12 Dec 2022 14:09:50 +0100 (CET) Date: Mon, 12 Dec 2022 14:09:50 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Cc: Frank Redeker Subject: Re: Strange behavior when executing programs Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com, Frank Redeker References: <1031eafe-fc3b-ab5b-6e63-b0f56c038332@razorcat.com> <71aa7f85-4441-1ef5-dd9f-1c5d09c151d3@razorcat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <71aa7f85-4441-1ef5-dd9f-1c5d09c151d3@razorcat.com> X-Provags-ID: V03:K1:EmDN7o5iWo9wKWfco5L+JAsOCq1XGcOBVXAlXTKicP6CO5/lDhA RpzBy2/v7n+9pnFoya6MQ+1EMuTE7eWkBvm4rAMlXSh1TJsMYaWlIQgwkezPSOuHUIdHcK0 P5KN8uY02FKjDPFgdfeJP9dyPXrZ8bOT8uMEIKbZnOT2rEwB4L4EpcB08NSWm/mlLevBI3N mrJeN18pK78A/CwzOTFAg== UI-OutboundReport: notjunk:1;M01:P0:pCLjGGLcLBU=;k/s2o+j+nZdkFjU8x8Cguk4TmKD xy0Fskr48hePRajo/My4VKdT1rG/3S+3fXRCFXNzGPKlmPxAkZSqMb4h9WbrazE3LoXud8Sat 8rLRDnMzdbR/tZYzYxKF081COItRKB4ytrtlxVHR7ySPI4vSQaBxNrdnTv4Yrzh9yUZ3p7BLi H64CAaI2VXWn21cUkONfu+d99vubt+zAgctRofvU25RdYRK9jhi4We6pvzfcnMMAdFiZtnL14 D5WNCjCGDU2a/8JSWco17WnYQastP+p2npAQJv/dbiLS6h+5FdkCBW2S6VFZWUYlf127QzGnt JBzlrgc+dswXRN/P+7lqUj4Ql7dx0CorCE9fbIo9JgF8H8WxYySJuUoA7Dpsl30LSEmOAQsEb S8qAtF/LvumgeuRYkU9acXgMQa6PG4WZlRcadCU+hWGK1j8jvi/4MqZXKS4lN5TS09UDiJK5/ cF0OIxuUUHMmSO57GlPj8PF+LJjWlPHndAeu2VT4u00QScCW14Qy83UY6pfmsgg6LVT6HQDyt 4pJWu7NVvVOHk63qRkKl8S3PIQCOau6DQPd6C6kDN3CzZZkQp4HAzizVjMFBdkI40ASGTMubG NggJgfYARWRH6JzJs+oSubiWthk+xZqOFfk2L6cGRo2t+d02HMUxAXQW3hUZovEaWiIrgJmsD 7+uLMqvCfSmD5uPJ694yfg/IqZ9Gr6jdUamOUxVD3g== X-Spam-Status: No, score=-101.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,GOOD_FROM_CORINNA_CYGWIN,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Dec 12 13:46, Frank Redeker via Cygwin wrote: > Am 12/12/2022 um 1:12 PM schrieb Corinna Vinschen: > > On Dec 12 11:21, Frank Redeker via Cygwin wrote: > > > $ pwd > > > /cygdrive/s/ado > > > > > > $ realpath /cygdrive/s/ado/msadox.dll > > > /cygdrive/s/ado/msadox.dll > > > > > > $ realpath msadox.dll > > > /cygdrive/c/Program Files/Common Files/System/ado/msadox.dll > > > > > > > > > Is there any way to restore the old behavior. Since with the new behavior my > > > tests no longer work. > > > > It's not easy. If we remove the new behaviour entirely, we break > > other scenarios which were broken in the old version. While it > > *seems* easy to fix your specific scenario, it will break again > > as soon as the substitution drive is used inside a native symlink. > > > > Virtual drive letters were always a problem and it doesn't get easier > > with Windows functions not allowing to specify whether one wants to > > follow symlinks or virt drives in inner path components or not. > > > > Let's consider this problem again, but I don't see a quick and easy > > solution. > > > > > > Corinna > Hello Corinna, I am willing to create my own version, tailored to my needs. Before you do that and decouple yourself from development, I'd suggest to look for a workaround in your code, or to see if we can't patch this behaviour in the upstream code. > It would be nice if you could provide me with the commit that was used to > implement the new behavior. (I guess the change is found inside the > *git://sourceware.org/git/newlib-cygwin.git* repository) Yes, but it's a group of patches trying to fix native symlink behaviour, spread over a couple of iterations. If you're looking for an easy workaround for your case, try this: diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index e7619270a269..131c7e88278f 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3492,8 +3492,10 @@ restart: { /* Check if the final path is an UNC path and the incoming path isn't. If so... */ - if (RtlEqualUnicodePathPrefix (&fpath, &ro_u_uncp, TRUE) - && !RtlEqualUnicodePathPrefix (&upath, &ro_u_uncp, TRUE)) + if (!RtlEqualUnicodePathPrefix (&upath, &ro_u_uncp, TRUE) + && (RtlEqualUnicodePathPrefix (&fpath, &ro_u_uncp, TRUE) + || towupper (upath.Buffer[4]) + != towupper (fpath.Buffer[4]))) { /* ...get the remote path, replace remote path with drive letter, check again. */ However, a generic solution would be preferrable, and a local patch to your scripts would be the better workaround for now. Corinna