You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christian Schulte (JIRA)" <ji...@apache.org> on 2015/12/18 01:31:46 UTC

[jira] [Commented] (MNG-5852) "mvn" script invokes /bin/sh but requires /bin/bash functions

    [ https://issues.apache.org/jira/browse/MNG-5852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15063171#comment-15063171 ] 

Christian Schulte commented on MNG-5852:
----------------------------------------

I am running 'OpenBSD 5.8'. '/bin/sh' also is 'ksh' and works flawlessly. Can you please confirm the following changes to 'apache-maven/src/bin/mvn' solve your issue?

{code}
@@ -197,8 +197,6 @@ fi
 # traverses directory structure from process work directory to filesystem root
 # first directory with .mvn subdirectory is considered project base directory
 find_maven_basedir() {
-  local basedir
-  local wdir
   basedir="$(pwd)"
   wdir="$(pwd)"
   while [ "$wdir" != '/' ] ; do
{code}



> "mvn" script invokes /bin/sh but requires /bin/bash functions
> -------------------------------------------------------------
>
>                 Key: MNG-5852
>                 URL: https://issues.apache.org/jira/browse/MNG-5852
>             Project: Maven
>          Issue Type: Bug
>          Components: Command Line
>    Affects Versions: 3.3.3
>         Environment: Solaris 11
>            Reporter: Jeffrey Alexander
>            Assignee: Christian Schulte
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)