Regression in parsing command-line arguments including variables
----------------------------------------------------------------
Key: MNG-4767
URL: http://jira.codehaus.org/browse/MNG-4767
Project: Maven 2 & 3
Issue Type: Bug
Components: Command Line
Affects Versions: 3.0-beta-1
Environment: Ubuntu, JDK 6. Applies to b2 as well as b1. Originally
reported as: http://netbeans.org/bugzilla/show_bug.cgi?id=189600
Reporter: Jesse Glick
Attachments: MNG-3529-revised.diff
Sorry for the long scroll bars but it is important to be precise here:
{noformat}
test189600$ /space/apache-maven-2.2.1/bin/mvn '-Dexec.args=output is '"'"'
${project.build.directory}'"'"'' -Dexec.executable=echo exec:exec
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'exec'.
[INFO] ------------------------------------------------------------------------
[INFO] Building test189600 OSGi Bundle
[INFO] task-segment: [exec:exec]
[INFO] ------------------------------------------------------------------------
[INFO] [exec:exec {execution: default-cli}]
output is /tmp/test189600/target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue Aug 17 12:25:54 EDT 2010
[INFO] Final Memory: 11M/169M
[INFO] ------------------------------------------------------------------------
test189600$ /space/apache-maven-3.0-beta-1/bin/mvn '-Dexec.args=output is '"'"'
${project.build.directory}'"'"'' -Dexec.executable=echo exec:exec
eval: 1: Bad substitution
test189600$
{noformat}
Regression caused by MNG-3529. I would suggest switching to option A, i.e.
using the generally safe {{"$@"}} rather than {{QUOTED_ARGS}}, retesting
carefully (is there a straightforward way to write unit tests for the script?),
and punting on the {{MAVEN_OPTS}} problem until a solution to that can be found
which does not regress anything else.
Note also that using {{exec}} as the last line of a launcher script is wise.
Otherwise you can run into problems with {{SIGTERM}} not being propagated
correctly to subprocesses when forking from another Java app (such as an IDE
launching Maven); Ctrl-C from a shell will work but
{{java.lang.Process.destroy}} will kill only the script and not the real Java
process. The workaround is rather cumbersome:
{noformat}
# setup, and then launch main process:
eval ...your stuff... '&'
PID=$!
trap "kill $PID" EXIT
wait $PID
exitcode=$?
trap '' EXIT
# can do cleanup here, or loop
exit $exitcode
{noformat}
Welcome to the joyous world of shell scripting.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira