maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Caradoc-Davies (JIRA)" <>
Subject [jira] [Created] (MNG-5882) Nonportable shell constructs cause bin/mvn errors on Debian
Date Tue, 01 Sep 2015 21:10:47 GMT
Ben Caradoc-Davies created MNG-5882:

             Summary: Nonportable shell constructs cause bin/mvn errors on Debian
                 Key: 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:

"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

$ 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.

This message was sent by Atlassian JIRA

View raw message