This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange cygpath behavior.

Den 2011-06-23 20:06 skrev Andrey Repin:
> Greetings, Marco atzeri!
>> On 6/23/2011 5:05 PM, Andrey Repin wrote:
>>> Greetings, Marco atzeri!
>>> Cygwin, to my best understanding, is supposed to transparently accept native
>>> Windows paths.
>> No, cygwin expects to receive POSIX/Unix paths
>> $ cygpath -h
>> [cut]
>>    -u, --unix            (default) print Unix form of NAMEs 
>> (/cygdrive/c/winnt)
>> so cygpath -u
>> expects to receive a Windows path and convert it in a unix one.
> That's your assumption. Which is not necessarily true. (Unless you're author
> of cygpath, in which case you have full authority to tell me what it is
> supposed to be.)
> Man page and reference card both do not specify the exact argument format,
> only the intended result format.

cygpath, at its core, calls some form of the cygwin_conv_path API. That
function takes either a POSIX path or a Win32 path and converts to the
other form. Anything interesting or useful that's happening when feeding
it a Win32 path and requesting it to convert from POSIX to Win32 is
purely coincidental and should not be relied upon. It you don't have a
desire to revisit your code later on and fix any breakage, that is...

(However, I'm not the cygpath author, but the src is readily available)

The fact that cygpath is not good for one-shot conversions from a Win32
path to some other form of Win32 path appears to not be explicitly
documented. But you should get the dos-file-warning if you try, which
should be a good hint that you are in murky waters.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]