Web lists-archives.com

Re: error in "cygpath" behavior




On 8/31/2018 4:57 AM, Corinna Vinschen wrote:
> On Aug 30 21:37, Steven Penny wrote:
>> It is my understanding that given relative input, "cygpath" shall produce
>> relative output unless given "-a" option. However I noticed a discrepancy. These
>> are all correct:
>>
>>    $ cygpath .
>>    .
>>
>>    $ cygpath ..
>>    ..
>>
>>    $ cygpath -w .
>>    .
>>
>> This is not:
>>
>>    $ cygpath -w ..
>>    C:\cygwin64\home\
> 
> Long-standing behaviour.  ".." in Cygwin and ".." in Windows can totally
> disagree.  The path is always convert to absolute at this point in favor
> of correct output.  There's also the additional restriction (though
> not in this case) that relative Windows paths must not be longer than
> MAX_PATH (260) chars.
> 
> I'm certainly open to patches to the underlying cygwin_conv_path
> function to change the Windows path to relative if possible.

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

-- 
cyg Simple

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