Fix quoting of start-stop-daemon RUN_ARGS and JAVA_OPTS in launch script

81a4763 introduced a regression when multiple RUN_ARGS or JAVA_OPTS were
configured. Rather than the JVM being launched with multiple arguments
all of the RUN_ARGS or JAVA_OPTS were passed as a single argument. This
caused unexpected behaviour and typically caused the application to fail
to start.

This commit updates the quoting of the arguments the are supplied when
launching the app using start-stop-daemon so that space-separated
entries in RUN_ARGS and JAVA_OPTS remain separate.

Closes gh-4866
This commit is contained in:
Andy Wilkinson 2016-01-11 17:57:38 +00:00
parent 04fe55a2ab
commit c39a55a270

View File

@ -147,6 +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 $*"
start-stop-daemon --start --quiet \
--chuid "$run_user" \
--name "$identity" \
@ -154,9 +155,7 @@ do_start() {
--background --no-close \
--startas "$javaexe" \
--chdir "$working_dir" \
-- \
-Dsun.misc.URLClassPath.disableJarChecking=true "${JAVA_OPTS[@]}" \
-jar "$jarfile" "${RUN_ARGS[@]}" "$@" \
-- $arguments \
>> "$log_file" 2>&1
await_file "$pid_file"
else