https://issues.apache.org/bugzilla/show_bug.cgi?id=48746
Summary: exec task sometimes inserts extraneous newlines
Product: Ant
Version: 1.8.0
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: [email protected]
ReportedBy: [email protected]
I'm running apache ant 1.8.0 on Red Hat Enterprise Linux 5.4, x86_64, with the
64-bit version of java 1.6.0_18 from sun (the latest available at least as of
last week). I can also see this behavior with 1.5.0_15, which is used in some
of our development environments for various reasons.
With ant 1.8.0, there is a fairly high probability that ant's exec task will
generate extraneous newlines in command output. For example, with this
build.xml file:
<project default="all">
<target name="all">
<exec executable="cat">
<arg value="/tmp/a"/>
</exec>
</target>
</project>
and the following /tmp/a:
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789
"most" of the time, I get the expected output:
Buildfile: /tmp/build.xml
all:
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
BUILD SUCCESSFUL
Total time: 0 seconds
but sometimes I get variations with an extraneous line break in an
indeterminate spot. For example:
[exec] 01234567890123456789012345
[exec] 678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
[exec] 01234567890123456789012345678901234567890123456789
BUILD SUCCESSFUL
Total time: 0 seconds
If I run ant 50 times in a loop, I see this or similar behavior (the line break
is not always in the same place) about 50% of the time. I'm running ANT like
this:
while true; do if JAVA_HOME=~/tmp/jdk1.6.0_18 $ANT_HOME/bin/ant -f
/tmp/build.xml | diff - /tmp/a1; then echo yes >> /tmp/a2; else echo no >>
/tmp/a2; done
where /tmp/a1 just contains what the ant command is supposed to contain.
I never see this behavior with 1.7.0, and I don't believe I've seen it with
1.7.1 either.
This problem is causing false test failures for us and will thus prevent us
from upgrading to 1.8.0 pending a solution. A quick diff of ExecTask.java
between versions doesn't reveal any relevant changes. Any suggestions on where
in the code to check? Let me know if there's anything you need me to test or
submit.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.