https://issues.apache.org/bugzilla/show_bug.cgi?id=44900
Summary: Exec: Nested args are not passed to task
Product: Ant
Version: 1.7.0
Platform: Other
OS/Version: AIX
Status: NEW
Severity: critical
Priority: P2
Component: Core tasks
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
Created an attachment (id=21877)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=21877)
A testcase to reproduce problem
Hi, I'm migrating an app from Ant 1.6.1 to Ant 1.7.0, and I have problems with
exec tasks. Ant execute task without passing arguments to process!
For example, I have this task definition:
<project name="permision" default="permision" basedir=".">
<property name="timeout" value="120000" />
<target name="permision">
<echo message="Modify directories permissions ${path}, mask
${dirMask}" />
<exec executable="chmod"
timeout="${timeout}"
failonerror="true">
<arg line="-R ${dirMask} ${path}" />
</exec>
<echo message="Modify files permissions ${path}, mask
${fileMask}" />
<exec executable="/data/bin/ant/permisions.sh"
timeout="${timeout}"
failonerror="true">
<arg line="${path} ${fileMask}" />
</exec>
</target>
</project>
An easy one, and works ok with Ant 1.6, as you can see in logs:
(...)
23 Apr 2008 17:31:10 [INFO ] Modify directories permissions /data/servers/ftp,
mask 755
23 Apr 2008 17:31:10 [DEBUG] Task "echo"finished
23 Apr 2008 17:31:10 [DEBUG] Task "exec" started
23 Apr 2008 17:31:10 [DEBUG] Current OS is AIX
23 Apr 2008 17:31:10 [DEBUG] Executing 'chmod' with arguments:
'-R'
'755'
'/data/servers/ftp'
The ' characters around the executable and arguments are
not part of the command.
23 Apr 2008 17:31:10 [DEBUG] Execute:Java13CommandLauncher: Executing 'chmod'
with arguments:
'-R'
'755'
'/data/servers/ftp
The ' characters around the executable and arguments are
not part of the command.
23 Apr 2008 17:31:10 [INFO ]
(...)
With Ant 1.7.0 I get this log:
24 Apr 2008 15:49:42 [DEBUG] Task "echo" started
24 Apr 2008 15:49:42 [INFO ] Modify directories permissions /data/servers/ftp,
mask 777
24 Apr 2008 15:49:42 [DEBUG] Task "echo"finished
24 Apr 2008 15:49:42 [DEBUG] Task "exec" started
24 Apr 2008 15:49:42 [DEBUG] Current OS is AIX
24 Apr 2008 15:49:42 [DEBUG] Executing 'chmod'
The ' characters around the executable and arguments are
not part of the command.
24 Apr 2008 15:49:42 [DEBUG] Execute:Java13CommandLauncher: Executing 'chmod'
The ' characters around the executable and arguments are
not part of the command.
24 Apr 2008 15:49:42 [INFO ] Usage: chmod [-R] [-f] [-h] {u|g|o|a ...} {+|-|=}
{r|w|x|X|s|t ...} File ...
24 Apr 2008 15:49:42 [INFO ] chmod [-R] [-f] [-h] OctalNumber File ...
24 Apr 2008 15:49:42 [INFO ] Changes the permission codes for files or
directories.
24 Apr 2008 15:49:42 [ERROR] Task "exec" finished with error (null)
24 Apr 2008 15:49:42 [ERROR] Target "permision" finished with error (null)
/data/bin/ant/permisions.xml:8: exec returned: 255
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:636)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:662)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:487)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at com.sbd.hardist.util.ant.AntProcess.execute(AntProcess.java:157)
Ant task isn't receiving parameters!
This task are executed using Ant's java api. If I execute task manually, all
goes ok too. And if I use deprecated <exec command, all goes fine too!
I'm using java 1.5.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.