aboutsummaryrefslogtreecommitdiff
path: root/make-distribution.sh
diff options
context:
space:
mode:
authorDavid Y. Ross <dyross@gmail.com>2015-01-26 14:26:10 -0800
committerPatrick Wendell <patrick@databricks.com>2015-01-26 14:26:10 -0800
commitb38034e878546a12c6d52f17fc961fd1a2453b97 (patch)
treeea0abfa1684c89ce679da37d0d7510892135018b /make-distribution.sh
parent54e7b456dd56c9e52132154e699abca87563465b (diff)
downloadspark-b38034e878546a12c6d52f17fc961fd1a2453b97.tar.gz
spark-b38034e878546a12c6d52f17fc961fd1a2453b97.tar.bz2
spark-b38034e878546a12c6d52f17fc961fd1a2453b97.zip
Fix command spaces issue in make-distribution.sh
Storing command in variables is tricky in bash, use an array to handle all issues with spaces, quoting, etc. See: http://mywiki.wooledge.org/BashFAQ/050 Author: David Y. Ross <dyross@gmail.com> Closes #4126 from dyross/dyr-fix-make-distribution and squashes the following commits: 4ce522b [David Y. Ross] Fix command spaces issue in make-distribution.sh
Diffstat (limited to 'make-distribution.sh')
-rwxr-xr-xmake-distribution.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/make-distribution.sh b/make-distribution.sh
index 4e2f400be3..0adca78518 100755
--- a/make-distribution.sh
+++ b/make-distribution.sh
@@ -115,7 +115,7 @@ if which git &>/dev/null; then
unset GITREV
fi
-if ! which $MVN &>/dev/null; then
+if ! which "$MVN" &>/dev/null; then
echo -e "Could not locate Maven command: '$MVN'."
echo -e "Specify the Maven command with the --mvn flag"
exit -1;
@@ -171,13 +171,16 @@ cd "$SPARK_HOME"
export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m"
-BUILD_COMMAND="$MVN clean package -DskipTests $@"
+# Store the command as an array because $MVN variable might have spaces in it.
+# Normal quoting tricks don't work.
+# See: http://mywiki.wooledge.org/BashFAQ/050
+BUILD_COMMAND=("$MVN" clean package -DskipTests $@)
# Actually build the jar
echo -e "\nBuilding with..."
-echo -e "\$ $BUILD_COMMAND\n"
+echo -e "\$ ${BUILD_COMMAND[@]}\n"
-${BUILD_COMMAND}
+"${BUILD_COMMAND[@]}"
# Make directories
rm -rf "$DISTDIR"