realpath issue with native[strict] symlinks

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Apr 19 12:58:08 GMT 2021


On Apr 18 10:59, Orgad Shaneh via Cygwin wrote:
> Hi,
> 
> When winsymlinks:native/nativestrict is used, realpath doesn't resolve
> the full path correctly, when a symlink to the same directory is used.
> 
> Example follows. The output is:
> /home/user/recurse/test/d1
> /home/user/recurse/test2/d1
> 
> While it should be /home/user/recurse/d1 for both.

I was going to write:

  Nothing we can do about without re-implementing Cygwin's path handling
  from scratch.  For historical reasons, POSIX paths are evaluated in a
  non-POSIXy manner from right to left.  If the resulting path is an
  existing path, the assumption is that no inner path component is a
  symlink.  That's true as long as Windows didn't support
  symlinks/junctions and Cygwin didn't support them.

But now I'm writing this:

  Probably I have a workaround for this problem.  I added a certain test
  to the function checking the outer path component, so the checks for
  path validity don't stop at the outer path component, just because
  it's a valid Windows path.

I pushed the patch and uploaded new developer snapshots to
https://cygwin.com/snapshots/

Please give them a try.


Thanks,
Corinna


More information about the Cygwin mailing list