public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_3-branch] Cygwin: path: Make some symlinks to /cygdrive/* work.
@ 2022-08-03  4:41 Takashi Yano
  0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2022-08-03  4:41 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e88d137c896d30a89161ac3f59ec36106fce13e0

commit e88d137c896d30a89161ac3f59ec36106fce13e0
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Mon Aug 1 09:02:23 2022 +0900

    Cygwin: path: Make some symlinks to /cygdrive/* work.
    
    - Previously, some symbolic links to /cygdrive/* (e.g. /cygdrive/C,
      /cygdrive/./c, /cygdrive//c, etc.) did not work. This patch fixes
      the issue.
      Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251994.html

Diff:
---
 winsup/cygwin/path.cc       | 6 +++++-
 winsup/cygwin/release/3.3.6 | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index eceafbbcf..c5ceb1da4 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1929,7 +1929,11 @@ symlink_wsl (const char *oldpath, path_conv &win32_newpath)
      cygdrive prefix is not "/", otherwise suffer random "/mnt" symlinks... */
   if (mount_table->cygdrive_len > 1
       && path_prefix_p (mount_table->cygdrive, oldpath,
-			mount_table->cygdrive_len, false))
+			mount_table->cygdrive_len, false)
+      && (strlen (oldpath + mount_table->cygdrive_len - 1) < 2
+	  || (islower (oldpath[mount_table->cygdrive_len])
+	      && (oldpath[mount_table->cygdrive_len + 1] == '/'
+		  || oldpath[mount_table->cygdrive_len + 1] == '\0'))))
     stpcpy (stpcpy (path_buf, "/mnt"),
 	    oldpath + mount_table->cygdrive_len - 1);
   else
diff --git a/winsup/cygwin/release/3.3.6 b/winsup/cygwin/release/3.3.6
index 5fb59bf7d..078e6e520 100644
--- a/winsup/cygwin/release/3.3.6
+++ b/winsup/cygwin/release/3.3.6
@@ -31,3 +31,7 @@ Bug Fixes
   native apps if *.bat or *.cmd is executed directly from cygwin
   shell.
   Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251993.html
+
+- Fix a problem that prevented some symbolic links to /cygdrive/C,
+  /cygdrive/./c, /cygdrive//c, etc. from working.
+  Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251994.html


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-03  4:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03  4:41 [newlib-cygwin/cygwin-3_3-branch] Cygwin: path: Make some symlinks to /cygdrive/* work Takashi Yano

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