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
This commit is contained in:
Takashi Yano 2022-08-01 09:02:23 +09:00
parent bfee9c6ab0
commit 8b502d8635
2 changed files with 9 additions and 1 deletions

View File

@ -1929,7 +1929,11 @@ symlink_wsl (const char *oldpath, path_conv &win32_newpath)
cygdrive prefix is not "/", otherwise suffer random "/mnt" symlinks... */ cygdrive prefix is not "/", otherwise suffer random "/mnt" symlinks... */
if (mount_table->cygdrive_len > 1 if (mount_table->cygdrive_len > 1
&& path_prefix_p (mount_table->cygdrive, oldpath, && 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"), stpcpy (stpcpy (path_buf, "/mnt"),
oldpath + mount_table->cygdrive_len - 1); oldpath + mount_table->cygdrive_len - 1);
else else

View File

@ -31,3 +31,7 @@ Bug Fixes
native apps if *.bat or *.cmd is executed directly from cygwin native apps if *.bat or *.cmd is executed directly from cygwin
shell. shell.
Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251993.html 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