ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Newton, Doug" <>
Subject PATCH SUBMISSION for ant shell script -- addresses change in cygp ath behaviour as of version 1.25
Date Wed, 12 Feb 2003 22:50:16 GMT
As of version 1.25, the cygwin utility cygpath's behaviour was silently
changed.  Previous to version 1.25 it would check to see if a path variable
was already of the right format, and not modify the path if it is not
needed.  Now it always modifies the path regardless of its format.

The bin/ant shell script was using cygpath to convert the path to unix
format regardless of its initial format.  So, if you already have a unix
format classpath, it will attempt to convert it anyway.  If the classpath is
longer than 260 characters, the result is a truncated classpath.

The change in cygpath behaviour is here to stay, so anyone using cygpath to
convert a classpath of unknown format must now check the format first to see
if it needs conversion.

I propose adding a check to determine if the classpath is in a windows
format before calling `cygpath --path --unix "$CLASSPATH"`.  

Current lines 78-79 of bin/ant in version 1.5.1:

  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`

Proposed replacement lines:

  if [ -n "$CLASSPATH" ] ; then
    case "$CLASSPATH" in
      *\;* | [a-zA-Z]:* | *\\*) CLASSPATH=`cygpath --path --unix
      *) ;;

The first two case pattern matches are exactly what cygpath previously
looked for to determine if a path was in windows format.  I added the
additional check for a backslash.  If I didn't catch all possible windows
classpath formats, please add to the pattern matches.

The code to be replaced is identical in both the main ant CVS branch and the
15 ant CVS branch, so it could changed in the main branch and merged with
the 15 branch.

I'm not a current ant developer, so I'm throwing this out for consideration.
If you have any questions, please contact me at

--Doug Newton

View raw message