You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2015/10/26 21:33:01 UTC
[Bug 58555] New: The dir attribute on Exec is not used if matches
working directory
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
Bug ID: 58555
Summary: The dir attribute on Exec is not used if matches
working directory
Product: Ant
Version: 1.9.0
Hardware: PC
Status: NEW
Severity: critical
Priority: P2
Component: Core tasks
Assignee: notifications@ant.apache.org
Reporter: gboysko@gmail.com
Created attachment 33223
--> https://bz.apache.org/bugzilla/attachment.cgi?id=33223&action=edit
Ant build script
This seems like such a fundamental problem, that I must be overlooking
something obvious. If you specify a directory for an <exec> task, then that
directory is not used if it happens to be the user's current working directory.
In this case, the directory used is the project's base directory.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
--- Comment #2 from Glenn Boysko <gb...@gmail.com> ---
Created attachment 33224
--> https://bz.apache.org/bugzilla/attachment.cgi?id=33224&action=edit
Updated build.xml with subdirectory specified as a property.
This is an update to the original build script that uses a property to
construct an absolute path to the subdirectory.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
--- Comment #3 from Stefan Bodewig <bo...@apache.org> ---
I see what you describe, but only with vmlauncher="false" - it works as
expected with vmlauncher="true". Am looking into it.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
--- Comment #6 from Stefan Bodewig <bo...@apache.org> ---
Of course it all made sense back then, at least until the change was made.
Prior to that dir always defaulted to the current working directory. Java 1.2
and earlier only had a Runtime.exec without a dir argument so we were forced to
use special platform dependent tricks for changing the directory. Setting dir
to null explicitly when it was the current working directory simplified the
bigger number of platform dependent hacks (no dir => use Runtime.exec).
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
Glenn Boysko <gb...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gboysko@gmail.com
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
Glenn Boysko <gb...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Hardware|PC |All
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
--- Comment #5 from Glenn Boysko <gb...@gmail.com> ---
So glad to hear that you've confirmed this. I, too, cannot believe no one else
reported this since it's introduction in 2001. Not sure how I can explain this.
We are creating a number of Ant scripts which rely on Node.js scripts, which
end in ".cmd" on Windows and have no suffix on Mac/Linux. So, we really need
vmlauncher="false".
I also agree that if a caller sets an attribute, it should not be overridden
without at least a warning message. In this case, it clearly changes the
behavior.
Look forward to hearing whether a fix gets into an upcoming build!
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
Glenn Boysko <gb...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--- Comment #1 from Glenn Boysko <gb...@gmail.com> ---
Place the build.xml in an empty directory. Create a new subdirectory called
"subdir" and put a few empty files.
Next, run the Ant script from the directory that contains build.xml. Observe
that it shows the listing of the "subdir" directory.
Now, invoke the Ant script from the "subdir" directory and observe it showing
the contents of the Project's base directory.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Target Milestone|--- |1.9.7
Resolution|--- |FIXED
--- Comment #7 from Stefan Bodewig <bo...@apache.org> ---
fixed with git commit 0ca8c46 (by never ignoring the dir attribute).
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 58555] The dir attribute on Exec is not used if matches working
directory
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58555
--- Comment #4 from Stefan Bodewig <bo...@apache.org> ---
Wow, this is old. And nobody has ever reported it before.
https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blobdiff;f=src/main/org/apache/tools/ant/taskdefs/Execute.java;h=b43da4f68d20c7899ef4e96577496d02e751607d;hp=bc768276b914a9c6a86f83e4856d40d1f593f7e1;hb=1dfa5ca002e81a1b89dbfd0fdd172bad141b829a;hpb=fc7cfffc89d82da7426c14b0fcd48682b026a56d
made in *2001* - first introduced in Ant 1.4.
At least this is where the root problem starts. Up until then a "null" dir has
always been treated as "use the CWD" and with the change the external launchers
used with vmlauncher="false" started to use the project's basedir rather than
the CWD if dir was null.
Even in that version the value of the dir attribute has been discarded if it
was the current working directory.
While I agree the current behavior is wrong, I'm a bit scared of what I might
break.
It might be best to not "null away" an explicit dir attribute at all. This
should keep the behavior as it is since by now all vmlaucher="true" launchers
happliy support executing in a different directory (now that we are in Java
1.3+ :-).
This would fix the current issue, but what remains is that an <exec> task
without any dir attribute defaults to the CWD for in-VM launchers and the
project's basedir for external launchers. I'd rather document than fix this,
TBH. Will consult with the other folks on the dev list before touching
anything.
--
You are receiving this mail because:
You are the assignee for the bug.