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

mvn shell script invokes /bin/sh but requires Bash functions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • 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 11

      Description

      The bin/mvn script uses the "local" command which is a shell builtin of bash and similar shells, but is not required for POSIX-compliance in sh. When I attempt to run mvn on my Solaris system, I see the following output:

      $ ./mvn
      ./mvn[200]: local: not found [No such file or directory]
      ./mvn[201]: local: not found [No such file or directory]
      ...
      

      Lines 200 and 201 invoke "local" to make local variables to the function. According to "man bash", this is a shell builtin. However, bin/mvn is invoked as:

      #!/bin/sh

      On most flavors of linux, this resolves to bash or dash which probably runs in a restricted environment after checking to see that its $0 is sh. But on Solaris's /bin/sh is actually ksh93 for backwards compatibility.

      Since "local" is not part of a POSIX-compliant /bin/sh, depending on it in a script that is invoked with /bin/sh is a bug.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael-o Michael Osipov
                Reporter:
                jhalex Jeffrey Alexander
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: