newlib-cygwin/winsup
Corinna Vinschen 19d59ce75d Cygwin: path_conv: Rework handling native symlinks as inner path components
commit 456c3a4638 was only going half-way.  It handled symlinks and
junction points as inner path components and made realpath return the
correct path, but it ignored drive letter substitution, i. e., virtual
drives created with, e. g.

  subst X: C:\foo\bar

It was also too simple.  Just returning an error code from
symlink_info::check puts an unnecessary onus on the symlink evaluation
loop in path_conv::check.

Rework the code to use GetFinalPathNameByHandle, and only do this after
checking the current file for being a symlink failed.

If the final path returned by GetFinalPathNameByHandle is not the same
as the incoming path, replace the incoming path with the POSIXified
final path.  This also short-circuits path evaluation, because
path_conv::check doesn't have to recurse over the inner path components
multiple times if all symlinks are of a native type, while still getting
the final path as end result.

Virtual drives are now handled like symlinks.  This is a necessary change
from before to make sure virtual drives are handled identically across
different access methods.  An example is realpath(1) from coreutils.  It
doesn't call readlink(2), but iterates over all path components using
lstat/readlink calls.  Both methods should result in the same real path.

Fixes: 456c3a4638 ("path_conv: Try to handle native symlinks more sanely")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-07 22:52:16 +02:00
..
CVSChangeLogs.old winsup: Move all old CVS Changelogs into CVSChangeLogs.old dir 2016-03-19 13:59:52 +01:00
cygserver Cygwin: drop all generated autotools files 2021-04-29 11:16:38 +02:00
cygwin Cygwin: path_conv: Rework handling native symlinks as inner path components 2021-05-07 22:52:16 +02:00
doc Cygwin: FAQ: building-cygwin: accomodate autoconf changes 2021-04-29 12:14:00 +02:00
testsuite Cygwin: automake: change @INCLUDES@ to @AM_CPPFLAGS@ to avoid warnings 2021-04-29 11:28:14 +02:00
utils Cygwin: automake: change @INCLUDES@ to @AM_CPPFLAGS@ to avoid warnings 2021-04-29 11:28:14 +02:00
CONTRIBUTORS Cygwin: Add Ben Wijen to list of contributors 2021-01-18 12:01:19 +01:00
COPYING
COPYING.LIB Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option 2016-06-23 10:09:17 +02:00
CYGWIN_LICENSE Clarify source file license in CYGWIN_LICENSE 2016-06-23 21:52:12 +02:00
Makefile.am Cygwin: Use automake (v5) 2021-04-27 16:49:56 +01:00
Makefile.am.common Cygwin: automake: change @INCLUDES@ to @AM_CPPFLAGS@ to avoid warnings 2021-04-29 11:28:14 +02:00
README Fix typo and wrong URL in winsup/README 2016-05-24 10:25:18 +02:00
acinclude.m4 Cygwin: automake: change @INCLUDES@ to @AM_CPPFLAGS@ to avoid warnings 2021-04-29 11:28:14 +02:00
autogen.sh Cygwin: autogen.sh: Allow running from any directory 2021-05-06 10:56:20 +02:00
configure.ac Cygwin: Use automake (v5) 2021-04-27 16:49:56 +01:00

README

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESSED OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Cygwin documentation is available on the net at https://cygwin.com
You might especially be interested in

https://cygwin.com/faq/faq.html#faq.programming.building-cygwin