Ben Caradoc-Davies created MNG-5882:
---------------------------------------

             Summary: Nonportable shell constructs cause bin/mvn errors on 
Debian
                 Key: MNG-5882
                 URL: https://issues.apache.org/jira/browse/MNG-5882
             Project: Maven
          Issue Type: Bug
          Components: Command Line
    Affects Versions: 3.3.3
         Environment: debian/unstable with dash 0.5.7-4+b1 amd64

Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 
2015-04-22T23:57:37+12:00)
Maven home: /home/ben/java/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.1.0-2-amd64", arch: "amd64", family: "unix"
            Reporter: Ben Caradoc-Davies


bin/mvn includes both local and export commands that perform assignment but do 
not protect against word splitting. These cause failures on Debian when run in 
a path with spaces because /bin/sh is dash which performs word splitting for 
assignment in local and export commands. See discussion here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=598239

"Bash and others treat 'local' (just like export, etc) differently, but it's a 
known shell portability issue."

For example, in this working directory:
{noformat}
/home/ben/geoserver/src with spaces/geotools
{noformat}

{noformat}
$ mvn [options]
/home/ben/java/maven/bin/mvn: 200: local: spaces/geotools: bad variable name
[...]
{noformat}

Moving the two local commands in find_maven_basedir to their own lines leaves:

{noformat}
$ mvn [options]
/home/ben/java/maven/bin/mvn: 221: export: spaces/geotools: bad variable name
{noformat}

So the export command for MAVEN_PROJECTBASEDIR is also affected, and needs to 
be moved to the following line. This is a regression because bin/mvn from Maven 
3.2.5 worked just fine on Debian in this working directory. Both problems are 
fixed in the attached patch.

Another workaround is to change the bin/mvn interpreter from /bin/sh to 
/bin/bash.



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

Reply via email to