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

mvn shell script fails with syntax error on Solaris 10

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.3
    • Fix Version/s: 3.5.0-alpha-1, 3.5.0
    • Component/s: Command Line
    • Labels:
      None
    • Environment:
      Solaris 10

      Description

      The $(cmd) idiom is used extensively in bin/mvn from lines 199-220, but this is not supported by older incarnations of /bin/sh (used on the shebang line). The `cmd` idiom is slightly more portable, and looks like it can probably be directly substituted.

      find_maven_basedir() {
        local basedir=$(pwd)
        local wdir=$(pwd)
        while [ "$wdir" != '/' ] ; do
          wdir=$(cd "$wdir/.."; pwd)
          if [ -d "$wdir"/.mvn ] ; then
            basedir=$wdir
            break
          fi
        done
        echo "${basedir}"
      }
      
      # concatenates all lines of a file
      concat_lines() {
        if [ -f "$1" ]; then
          echo "$(tr -s '\n' ' ' < "$1")"
        fi
      }
      
      export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
      MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
      

      See MNG-5658 for an earlier case of a similar problem.

        Issue Links

          Activity

          Hide
          michael-o Michael Osipov added a comment -

          I believe this has been already fixed. Several improvements for Solaris quirks have been made and no $() calls are present in the script. If this is still an issue, reopen and provide a patch.

          Show
          michael-o Michael Osipov added a comment - I believe this has been already fixed. Several improvements for Solaris quirks have been made and no $() calls are present in the script. If this is still an issue, reopen and provide a patch.
          Hide
          michael-o Michael Osipov added a comment -

          See commit for the change.

          Show
          michael-o Michael Osipov added a comment - See commit for the change.
          Hide
          michael-o Michael Osipov added a comment -

          The shell on Solaris is not POSIX-compliant, therefore it does not support the $() construct, though this is highly preferred over backticks.

          Show
          michael-o Michael Osipov added a comment - The shell on Solaris is not POSIX-compliant, therefore it does not support the $() construct, though this is highly preferred over backticks.
          Hide
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with 1d9708a954e2d764f6ba933c4e9ba117afa9b4c4 .
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1531 (See https://builds.apache.org/job/maven-3.x/1531/)
          MNG-5829 mvn shell script fails with syntax error on Solaris 10 (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=1d9708a954e2d764f6ba933c4e9ba117afa9b4c4)

          • (edit) apache-maven/src/bin/mvnyjp
          • (edit) apache-maven/src/bin/mvnDebug
          • (edit) apache-maven/src/bin/mvn
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1531 (See https://builds.apache.org/job/maven-3.x/1531/ ) MNG-5829 mvn shell script fails with syntax error on Solaris 10 (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=1d9708a954e2d764f6ba933c4e9ba117afa9b4c4 ) (edit) apache-maven/src/bin/mvnyjp (edit) apache-maven/src/bin/mvnDebug (edit) apache-maven/src/bin/mvn

            People

            • Assignee:
              michael-o Michael Osipov
              Reporter:
              zacthompson Zac Thompson
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development