public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Cc: Frank Redeker <frank.redeker@razorcat.com>
Subject: Re: Strange behavior when executing programs
Date: Mon, 12 Dec 2022 14:09:50 +0100	[thread overview]
Message-ID: <Y5coHjIceQnpQgNN@calimero.vinschen.de> (raw)
In-Reply-To: <71aa7f85-4441-1ef5-dd9f-1c5d09c151d3@razorcat.com>

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

  reply	other threads:[~2022-12-12 13:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 10:21 Frank Redeker
2022-12-12 12:12 ` Corinna Vinschen
2022-12-12 12:46   ` Frank Redeker
2022-12-12 13:09     ` Corinna Vinschen [this message]
2022-12-13  9:51       ` Corinna Vinschen
2022-12-13 12:54         ` Frank Redeker
2022-12-13 14:15           ` Corinna Vinschen
2022-12-13 16:35             ` Frank Redeker
2022-12-13 16:54               ` Jon Turney
2022-12-13 17:04                 ` Oskar Skog
2022-12-14  5:38         ` Frank Redeker
2022-12-14 10:14           ` Corinna Vinschen
2022-12-12 14:52   ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-12-12 15:20     ` Corinna Vinschen
2022-12-12 15:29       ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-12-12 15:40         ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-12-12 15:42         ` Corinna Vinschen
2022-12-12 15:50           ` Corinna Vinschen
2022-12-12 15:22     ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-12-12 15:41       ` Corinna Vinschen
2022-12-12 16:40         ` Frank Redeker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y5coHjIceQnpQgNN@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=frank.redeker@razorcat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).