Merge pull request #17496 from jasontedor/eval-with-spaces

Quote path to java binary
This commit is contained in:
Jason Tedor 2016-04-06 13:43:23 -04:00
commit d113e1fc97
2 changed files with 22 additions and 1 deletions

View File

@ -110,4 +110,4 @@ fi
HOSTNAME=`hostname | cut -d. -f1`
export HOSTNAME
eval "$JAVA" -client -Delasticsearch -Des.path.home="\"$ES_HOME\"" $properties -cp "\"$ES_HOME/lib/*\"" org.elasticsearch.plugins.PluginCli $args
eval "\"$JAVA\"" -client -Delasticsearch -Des.path.home="\"$ES_HOME\"" $properties -cp "\"$ES_HOME/lib/*\"" org.elasticsearch.plugins.PluginCli $args

View File

@ -455,3 +455,24 @@ fi
fi
remove_jvm_example
}
@test "[$GROUP] test java home with space" {
# preserve JAVA_HOME
local java_home=$JAVA_HOME
# create a JAVA_HOME with a space
local java=$(which java)
local temp=`mktemp -d --suffix="java home"`
mkdir -p "$temp/bin"
ln -s "$java" "$temp/bin/java"
export JAVA_HOME="$temp"
# this will fail if the elasticsearch-plugin script does not
# properly handle JAVA_HOME with spaces
"$ESHOME/bin/elasticsearch-plugin" list
rm -rf "$temp"
# restore JAVA_HOME
export JAVA_HOME=$java_home
}