ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 50781] javac task creates long command line
Date Thu, 05 Jul 2012 02:35:28 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50781

--- Comment #12 from Justin Ryan <justin@halfempty.org> ---
(In reply to comment #9)
> BTW the patch as it stands is wrong, since it ignores the documented
> firstFileName parameter.

I agree that my origin patch wasn't ideal and is broken in respect to
firstFileName. 

> (The patch also, curiously, behaves as if firstFileName=1 rather than =0: it
> copies over the first real arg unchanged, then adds the @rest. This could
> fail in case the first arg happened to be something very long, such as
> -J-Xbootclasspath/p:/some/long/path/to/compiler/patch.jar.)

Your patch while much better it is lacking in one respect, it could potentially
create commandArray of size 1 with just the name of the @tmpfile, which isn't
an executable. You need to maintain index 0, since it is pointing to the actual
javac.exe (that's one thing my patch got right). Keep in mind that commandArray
 is cmd in CommandLaucher.exec and eventually becomes
Runtime.getRuntime().exec(cmd, env). I believe you're assuming the first
element in the array is the first command line argument.

Previous to this change, firstFileName would never practically been 0, so the
lurking bug of setting commandArray with a size of 1 would never happen. I
think if you change this:

Project.toBoolean(project.getProperty("pre-50781")) ? cmd.size() : 0;

to:

Project.toBoolean(project.getProperty("pre-50781")) ? cmd.size() : 1;

You'll avoid the problem, and the it will fix this defect.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Mime
View raw message