Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.3.3
-
None
-
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"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"
Description
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:
/home/ben/geoserver/src with spaces/geotools
Running bin/mvn results in:
$ mvn [options] /home/ben/java/maven/bin/mvn: 200: local: spaces/geotools: bad variable name [...]
Moving the two local commands in find_maven_basedir to their own lines leaves:
$ mvn [options] /home/ben/java/maven/bin/mvn: 221: export: spaces/geotools: bad variable name
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.