Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4767

Regression in parsing command-line arguments including variables

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Patch

    Description

      Sorry for the long scroll bars but it is important to be precise here:

      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$ 
      

      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:

      # 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
      

      Welcome to the joyous world of shell scripting.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            bentmann Benjamin Bentmann
            jglick Jesse N. Glick
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment