Address Shellcheck warning (SC2086) for $arguments in launch script

$arguments needs to be split on spaces so it can’t just be wrapped
in quotes. This commit updates arguments to be an array that is then
expanded ("{arguments[@]}"). The use of @ and double quotes means that
it is expanded into all elements individually quoted.

See gh-4866
This commit is contained in:
Andy Wilkinson 2016-01-14 10:26:01 +00:00
parent 27a81e1463
commit 3afd0c7b3b

View File

@ -147,7 +147,7 @@ do_start() {
chown "$run_user" "$pid_file"
chown "$run_user" "$log_file"
if [ "${useStartStopDaemon:-true}" = true ] && type start-stop-daemon > /dev/null 2>&1; then
arguments="-Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS -jar $jarfile $RUN_ARGS $*"
arguments=(-Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS -jar $jarfile $RUN_ARGS "$@")
start-stop-daemon --start --quiet \
--chuid "$run_user" \
--name "$identity" \
@ -155,7 +155,7 @@ do_start() {
--background --no-close \
--startas "$javaexe" \
--chdir "$working_dir" \
-- $arguments \
-- "${arguments[@]}" \
>> "$log_file" 2>&1
await_file "$pid_file"
else