-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-3692: Add quotes to variables in kafka-run-class.sh #1364
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,85 +50,85 @@ fi | |
|
||
# run ./gradlew copyDependantLibs to get all dependant jars in a local dir | ||
shopt -s nullglob | ||
for dir in $base_dir/core/build/dependant-libs-${SCALA_VERSION}*; | ||
for dir in "$base_dir"/core/build/dependant-libs-${SCALA_VERSION}*; | ||
do | ||
if [ -z $CLASSPATH ] ; then | ||
CLASSPATH=$dir/* | ||
if [ -z "$CLASSPATH" ] ; then | ||
CLASSPATH="$dir/*" | ||
else | ||
CLASSPATH=$CLASSPATH:$dir/* | ||
CLASSPATH="$CLASSPATH:$dir/*" | ||
fi | ||
done | ||
|
||
for file in $base_dir/examples/build/libs/kafka-examples*.jar; | ||
for file in "$base_dir"/examples/build/libs/kafka-examples*.jar; | ||
do | ||
if should_include_file "$file"; then | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
fi | ||
done | ||
|
||
for file in $base_dir/clients/build/libs/kafka-clients*.jar; | ||
for file in "$base_dir"/clients/build/libs/kafka-clients*.jar; | ||
do | ||
if should_include_file "$file"; then | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
fi | ||
done | ||
|
||
for file in $base_dir/streams/build/libs/kafka-streams*.jar; | ||
for file in "$base_dir"/streams/build/libs/kafka-streams*.jar; | ||
do | ||
if should_include_file "$file"; then | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
fi | ||
done | ||
|
||
for file in $base_dir/streams/examples/build/libs/kafka-streams-examples*.jar; | ||
for file in "$base_dir"/streams/examples/build/libs/kafka-streams-examples*.jar; | ||
do | ||
if should_include_file "$file"; then | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
fi | ||
done | ||
|
||
for file in $base_dir/streams/build/dependant-libs-${SCALA_VERSION}/rocksdb*.jar; | ||
for file in "$base_dir"/streams/build/dependant-libs-${SCALA_VERSION}/rocksdb*.jar; | ||
do | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
done | ||
|
||
for file in $base_dir/tools/build/libs/kafka-tools*.jar; | ||
for file in "$base_dir"/tools/build/libs/kafka-tools*.jar; | ||
do | ||
if should_include_file "$file"; then | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
fi | ||
done | ||
|
||
for dir in $base_dir/tools/build/dependant-libs-${SCALA_VERSION}*; | ||
for dir in "$base_dir"/tools/build/dependant-libs-${SCALA_VERSION}*; | ||
do | ||
CLASSPATH=$CLASSPATH:$dir/* | ||
CLASSPATH="$CLASSPATH:$dir/*" | ||
done | ||
|
||
for cc_pkg in "api" "runtime" "file" "json" "tools" | ||
do | ||
for file in $base_dir/connect/${cc_pkg}/build/libs/connect-${cc_pkg}*.jar; | ||
for file in "$base_dir"/connect/${cc_pkg}/build/libs/connect-${cc_pkg}*.jar; | ||
do | ||
if should_include_file "$file"; then | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
fi | ||
done | ||
if [ -d "$base_dir/connect/${cc_pkg}/build/dependant-libs" ] ; then | ||
CLASSPATH=$CLASSPATH:$base_dir/connect/${cc_pkg}/build/dependant-libs/* | ||
CLASSPATH="$CLASSPATH:$base_dir/connect/${cc_pkg}/build/dependant-libs/*" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason that we quote the whole value here but individual components in other places such as in line 112? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe @granders can comment as he knows much shell than I do. Here is what I get from running shellcheck if I only quote CLASSPATH, which is a tool to check issues in shell scripts. I think as the globs are treated as literals, it seems OK to include in the glob in the quote. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that these forms are equivalent, (and that globs are literal in assignments) so it actually doesn't make a difference. (On the other hand, I believe the separation is needed for loops (not assignments) to make use of nullglob trickery to make sure nonexistent files aren't added to the classpath) |
||
fi | ||
done | ||
|
||
# classpath addition for release | ||
for file in $base_dir/libs/*; | ||
for file in "$base_dir"/libs/*; | ||
do | ||
if should_include_file "$file"; then | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
fi | ||
done | ||
|
||
for file in $base_dir/core/build/libs/kafka_${SCALA_BINARY_VERSION}*.jar; | ||
for file in "$base_dir"/core/build/libs/kafka_${SCALA_BINARY_VERSION}*.jar; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't quote There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we definitely want to keep the quotes off of It's probably preferable to use something like |
||
do | ||
if should_include_file "$file"; then | ||
CLASSPATH=$CLASSPATH:$file | ||
CLASSPATH="$CLASSPATH":"$file" | ||
fi | ||
done | ||
shopt -u nullglob | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In line 98, we quote
$CLASSPATH
and$file
separately while here we quote both variables together. Is it because of the*
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the two forms are equivalent