cygpath bug in version 1.25 -- Fundamental Change in the Behaviour of Cygpath

Max Bowsher maxb@ukf.net
Wed Feb 12 00:15:00 GMT 2003


Igor Pechtchanski wrote:
> On Tue, 11 Feb 2003, Newton, Doug wrote:
>
>> If this change is what is desired by the majority, that is fine.
>> BUT, it should have been made clear that the fundamental behaviour
>> of cygpath had changed.  I have many scripts that no longer work.
>> Even the jakarata ant tool's start-up script now mangles the
>> classpath because of this change in behaviour.
>
> This change makes the output correct.  I suppose that would be
> something desired by the majority...

Yet technical correctness has come at the price of usability and
functionality.
E.g. You cannot convert to --mixed style from --windows style with --path.

>> At least with version 1.21 (and I believe through 1.24, just glancing
>> through the CVS history), the behaviour was always as follows:
>>
>> "cygpath --path --unix $UNIX_CLASSPATH" returns UNIX_CLASSPATH
>> "cygpath --path --unix $DOS_CLASSPATH" return UNIX_CLASSPATH
>> "cygpath --path --windows $UNIX_CLASSPATH" returns DOS_CLASSPATH
>> "cygpath --path --windows $DOS_CLASSPATH" returns DOS_CLASSPATH
>>
>> Now the behaviour is as follows:
>>
>> "cygpath --path --unix $UNIX_CLASSPATH" returns a truncated
>> UNIX_CLASSPATH if it is too long
>
> Yes, because it treats it as one filename...
>
>> "cygpath --path --unix $DOS_CLASSPATH" return UNIX_CLASSPATH
>> "cygpath --path --windows $UNIX_CLASSPATH" returns DOS_CLASSPATH
>> "cygpath --path --windows $DOS_CLASSPATH" returns a garbled
>> DOS_CLASSPATH regardless of length (e.g. the path is transformed
>> from "C:/home/build" to "C;c:/home/build"
>
> Yes, because it treats ":" as a separator.
>
>> We no longer have the option to run a classpath of unknown format
>> through cgypath to make sure it is in a known format.  This is the
>> issue in the jakarta ant tool.  It makes no assumptions on what the
>> format of the path is -- it immediately converts it to unix
>> regardless of the current format.
>
> It makes an assumption that the format is Windows.  Otherwise,
> there'd be no need to convert to Unix format...

Of course, if you simply wanted to *ensure* that the path was in unix
format... you're stuck.

>> Is there another utility that can be used to identify the format of a
>> classpath?  This will be needed to account for the changed behaviour
>> in modifying scripts.
>
> Umm, 'grep'?  In particular, grep for a ";" or a "\" for a
> windows-format path...

Which is presumably vaguely what cygpath used to do.

Doug: have you considered making a patch to cygpath to make it behave more
to your liking (conditional on a command line option if need be), and
submitting that?



Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list