error in "cygpath" behavior

Thomas Wolff towo@towo.net
Sat Sep 1 07:17:00 GMT 2018


Am 31.08.2018 um 22:05 schrieb Eric Blake:
> 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.
As a side-note, this is also the reason that you may be facing apparent 
inconsistency with path name completion,
like `ls ../[TAB]` suggesting you files and directories that do not 
exist once you run the command.
This is not cygwin-specific.

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus


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



More information about the Cygwin mailing list