Web lists-archives.com

Re: error in "cygpath" behavior

On 08/31/2018 02:48 PM, cyg Simple wrote:

Don't forget the possibility that '..' points to a symlink which Windows
will not understand.

$ mkdir -p /foo/baz
$ ln -s /foo /bar
$ cd /bar/baz
$ cygpath -w ..

Except .. never points to a symlink. It always points to the physical directory that contains the current directory (that is, /foo, not /bar). The shell can maintain a notion of a logical current directory (based on whether you use 'set -P' for physical or 'set +P' for logical; where bash defaults to +P), and in that mode, 'cd ..' behaves logically (acting as though you are now in /bar, rather than actually changing you to /foo). But that still doesn't change the fact that '..' in file name resolution never resolves to a symlink, because the shell is merely rewriting your ".." to avoid passing it on to the syscalls, rather than the syscalls actually knowing about logical mode.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple