From 67520ddd961c82602013f4c7d952410627553ecf Mon Sep 17 00:00:00 2001 From: Andrew Egelhofer Date: Thu, 27 Feb 2020 17:33:47 -0800 Subject: [PATCH] MINOR: Double Quote CLASSPATH to prevent shell glob expansion. In the event that the CLASSPATH does not have an ending ":", the shell can expand the CLASSPATH globs to be space-separated list of paths/jars, which is not how the JVM CLI accepts arguments to -cp switch. So double quote the variable to prevent pattern expansion, and pass the glob pattern directly to the JVM. --- bin/kafka-run-class.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index 09f699721c2e1..914690ebcc98a 100755 --- a/bin/kafka-run-class.sh +++ b/bin/kafka-run-class.sh @@ -313,7 +313,7 @@ CLASSPATH=${CLASSPATH#:} # Launch mode if [ "x$DAEMON_MODE" = "xtrue" ]; then - nohup $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" > "$CONSOLE_OUTPUT_FILE" 2>&1 < /dev/null & + nohup $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp "$CLASSPATH" $KAFKA_OPTS "$@" > "$CONSOLE_OUTPUT_FILE" 2>&1 < /dev/null & else - exec $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" + exec $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp "$CLASSPATH" $KAFKA_OPTS "$@" fi