ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 30921] - Quotes in CLASSPATH can screw up ant.bat
Date Fri, 07 Jan 2005 15:03:13 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30921>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30921





------- Additional Comments From ant@kruithof.xs4all.nl  2005-01-07 16:03 -------
As from batch files the check does return true the following comment is not valid.

> so also here either error or the result is always the same, or deviates from the
> same only if it shouldn't have deviated.

I have instrumented ant to show what is added to the classpath if the check is
removed:
while giving the command
ant test

with the line (as present currently)
"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar"
"-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp
"%CLASSPATH%" %ANT_CMD_LINE_ARGS%

CLASSPATH set to | passed to ant          | added to classpath by ant
<not set>        | -cp "" test            | nothing added (not even empty dir)
"some path"      | -cp ""some path"" test | C:\ant\dist\some (1)
some path        | -cp "some path" test   | C:\ant\dist\some path

(1) in this case the word path is interpreted as the first target, instead of
being part of the classpath.

with the modified line
"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar"
"-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp
%CLASSPATH% %ANT_CMD_LINE_ARGS%

CLASSPATH set to | passed to ant          | added to classpath by ant
<not set>        | -cp test               | C:\ant\dist\test (2)
"some path"      | -cp "some path" test   | C:\ant\dist\some path
some path        | -cp some path test     | C:\ant\dist\some (3)

(2) note that the check was removed test was the specified target.
(3) note that path was removed from the claspath but added as target.

So we can see that indeed the next problem when removing or replacing the test
would be how to recognise where the classpath ends, either when " are used in
the CLASSPATH and the batch script adds " or when no " are used in the CLASSPATH
and the batch script doesn't add ".

It currently works if the CLASSPATH does not contain " even when the CLASSPATH
contains spaces.
Removing the quotes from the call would break this.

when looking at the environment variables defined per default in windows XP none
of them contain quotes especially all other paths including the normal PATH and
the HOMEPATH variables are surrounded by ".

It may be possible to fix this by combining a solution in the ant scripts with
an solution in the Launcher.java, but it wouldn't be easy.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message