stczwd commented on a change in pull request #35763:
URL: https://github.com/apache/spark/pull/35763#discussion_r821684004
##########
File path: sbin/spark-daemon.sh
##########
@@ -149,7 +149,7 @@ execute_command() {
sleep 2
# Check if the process has died; in that case we'll tail the log so the
user can see
if [[ ! $(ps -p "$newpid" -o comm=) =~ "java" ]]; then
- echo "failed to launch: $@"
+ echo "failed to launch: $*"
Review comment:
SC2145 (error): Argument mixes string and array. Use * or separate
argument.
##########
File path: bin/docker-image-tool.sh
##########
@@ -284,7 +284,7 @@ Examples:
EOF
}
-if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
+if [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path: R/install-source-package.sh
##########
@@ -40,7 +40,7 @@ fi
if [ ! -f "$FWDIR/SparkR_$VERSION.tar.gz" ]; then
echo -e "R source package file '$FWDIR/SparkR_$VERSION.tar.gz' is not found."
echo -e "Please build R source package with check-cran.sh"
- exit -1;
+ exit 255;
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: R/run-tests.sh
##########
@@ -66,7 +66,7 @@ else
echo -en "\033[31m" # Red
echo "Had CRAN check errors; see logs."
echo -en "\033[0m" # No color
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/check-license
##########
@@ -35,7 +35,7 @@ acquire_rat_jar () {
wget --quiet ${URL} -O "$JAR_DL" && mv "$JAR_DL" "$JAR"
else
printf "You do not have curl or wget installed, please install rat
manually.\n"
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/run-tests-jenkins
##########
@@ -31,7 +31,7 @@ export LANG="en_US.UTF-8"
PYTHON_VERSION_CHECK=$(python3 -c 'import sys; print(sys.version_info < (3, 6,
0))')
if [[ "$PYTHON_VERSION_CHECK" == "True" ]]; then
echo "Python versions prior to 3.6 are not supported."
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/create-release/release-tag.sh
##########
@@ -42,7 +42,7 @@ EOF
set -e
set -o pipefail
-if [[ $@ == *"help"* ]]; then
+if [[ "$*" == *"help"* ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path: sbin/start-master.sh
##########
@@ -27,7 +27,7 @@ fi
# Any changes need to be reflected there.
CLASS="org.apache.spark.deploy.master.Master"
-if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
+if [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path:
resource-managers/kubernetes/integration-tests/scripts/setup-integration-test-env.sh
##########
@@ -118,7 +118,7 @@ then
# Build SparkR image
tags=(${EXCLUDE_TAGS//,/ })
- if [[ ! ${tags[@]} =~ "r" ]]; then
+ if [[ ! "${tags[*]}" =~ "r" ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path: sbin/start-thriftserver.sh
##########
@@ -50,7 +50,7 @@ function usage {
"${SPARK_HOME}"/bin/spark-class $CLASS --help 2>&1 | grep -v "$pattern" 1>&2
}
-if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
+if [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path: dev/make-distribution.sh
##########
@@ -170,24 +170,28 @@ BUILD_COMMAND=("$MVN" clean package -DskipTests $@)
# Actually build the jar
echo -e "\nBuilding with..."
-echo -e "\$ ${BUILD_COMMAND[@]}\n"
+echo -e "\$ ${BUILD_COMMAND[*]}\n"
"${BUILD_COMMAND[@]}"
# Make directories
rm -rf "$DISTDIR"
mkdir -p "$DISTDIR/jars"
echo "Spark $VERSION$GITREVSTRING built for Hadoop $SPARK_HADOOP_VERSION" >
"$DISTDIR/RELEASE"
-echo "Build flags: $@" >> "$DISTDIR/RELEASE"
+echo "Build flags: $*" >> "$DISTDIR/RELEASE"
Review comment:
SC2145 (error): Argument mixes string and array. Use * or separate
argument.
##########
File path: dev/make-distribution.sh
##########
@@ -123,26 +123,26 @@ fi
if [ ! "$(command -v "$MVN")" ] ; then
echo -e "Could not locate Maven command: '$MVN'."
echo -e "Specify the Maven command with the --mvn flag"
- exit -1;
+ exit 255;
fi
-VERSION=$("$MVN" help:evaluate -Dexpression=project.version $@ \
+VERSION=$("$MVN" help:evaluate -Dexpression=project.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version $@ \
+SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version "$@" \
Review comment:
SC2068 (error): Double quote array expansions to avoid re-splitting
elements.
##########
File path: dev/make-distribution.sh
##########
@@ -123,26 +123,26 @@ fi
if [ ! "$(command -v "$MVN")" ] ; then
echo -e "Could not locate Maven command: '$MVN'."
echo -e "Specify the Maven command with the --mvn flag"
- exit -1;
+ exit 255;
fi
-VERSION=$("$MVN" help:evaluate -Dexpression=project.version $@ \
+VERSION=$("$MVN" help:evaluate -Dexpression=project.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version $@ \
+SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SPARK_HADOOP_VERSION=$("$MVN" help:evaluate -Dexpression=hadoop.version $@ \
+SPARK_HADOOP_VERSION=$("$MVN" help:evaluate -Dexpression=hadoop.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SPARK_HIVE=$("$MVN" help:evaluate -Dexpression=project.activeProfiles -pl
sql/hive $@ \
+SPARK_HIVE=$("$MVN" help:evaluate -Dexpression=project.activeProfiles -pl
sql/hive "$@" \
Review comment:
SC2068 (error): Double quote array expansions to avoid re-splitting
elements.
##########
File path: build/sbt-launch-lib.bash
##########
@@ -62,13 +62,13 @@ acquire_sbt_jar () {
mv "${JAR_DL}" "${JAR}"
else
printf "You do not have curl or wget installed, please install sbt
manually from https://www.scala-sbt.org/\n"
- exit -1
+ exit 255
fi
fi
if [ ! -f "${JAR}" ]; then
# We failed to download
printf "Our attempt to download sbt locally to ${JAR} failed. Please
install sbt manually from https://www.scala-sbt.org/\n"
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/make-distribution.sh
##########
@@ -123,26 +123,26 @@ fi
if [ ! "$(command -v "$MVN")" ] ; then
echo -e "Could not locate Maven command: '$MVN'."
echo -e "Specify the Maven command with the --mvn flag"
- exit -1;
+ exit 255;
fi
-VERSION=$("$MVN" help:evaluate -Dexpression=project.version $@ \
+VERSION=$("$MVN" help:evaluate -Dexpression=project.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version $@ \
+SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SPARK_HADOOP_VERSION=$("$MVN" help:evaluate -Dexpression=hadoop.version $@ \
+SPARK_HADOOP_VERSION=$("$MVN" help:evaluate -Dexpression=hadoop.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SPARK_HIVE=$("$MVN" help:evaluate -Dexpression=project.activeProfiles -pl
sql/hive $@ \
+SPARK_HIVE=$("$MVN" help:evaluate -Dexpression=project.activeProfiles -pl
sql/hive "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| fgrep --count "<id>hive</id>";\
- # Reset exit status to 0, otherwise the script stops here if the last grep
finds nothing\
+ # Reset exit status to 0, otherwise the script stops here if the last grep
finds nothing
Review comment:
SC1143 (error): This backslash is part of a comment and does not
continue the line.
##########
File path: dev/make-distribution.sh
##########
@@ -123,26 +123,26 @@ fi
if [ ! "$(command -v "$MVN")" ] ; then
echo -e "Could not locate Maven command: '$MVN'."
echo -e "Specify the Maven command with the --mvn flag"
- exit -1;
+ exit 255;
fi
-VERSION=$("$MVN" help:evaluate -Dexpression=project.version $@ \
+VERSION=$("$MVN" help:evaluate -Dexpression=project.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version $@ \
+SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version "$@" \
| grep -v "INFO"\
| grep -v "WARNING"\
| tail -n 1)
-SPARK_HADOOP_VERSION=$("$MVN" help:evaluate -Dexpression=hadoop.version $@ \
+SPARK_HADOOP_VERSION=$("$MVN" help:evaluate -Dexpression=hadoop.version "$@" \
Review comment:
SC2068 (error): Double quote array expansions to avoid re-splitting
elements.
##########
File path: sql/core/src/test/scripts/gen-thrift.sh
##########
@@ -22,6 +24,6 @@ cd -
rm -rf $BASEDIR/gen-java
mkdir -p $BASEDIR/gen-java
-for input in `ls $BASEDIR/thrift/*.thrift`; do
+for input in $BASEDIR/thrift/*.thrift; do
Review comment:
SC2045 (error): Iterating over ls output is fragile. Use globs.
##########
File path: R/run-tests.sh
##########
@@ -56,7 +56,7 @@ if [[ $FAILED != 0 || $NUM_TEST_WARNING != 0 ]]; then
echo -en "\033[31m" # Red
echo "Had test warnings or failures; see logs."
echo -en "\033[0m" # No color
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/make-distribution.sh
##########
@@ -108,7 +108,7 @@ fi
if [ -z "$JAVA_HOME" ]; then
echo "Error: JAVA_HOME is not set, cannot proceed."
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: build/sbt-launch-lib.bash
##########
@@ -62,13 +62,13 @@ acquire_sbt_jar () {
mv "${JAR_DL}" "${JAR}"
else
printf "You do not have curl or wget installed, please install sbt
manually from https://www.scala-sbt.org/\n"
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/check-license
##########
@@ -44,7 +44,7 @@ acquire_rat_jar () {
# We failed to download
rm "$JAR"
printf "Our attempt to download rat locally to ${JAR} failed. Please
install rat manually.\n"
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/create-release/release-build.sh
##########
@@ -53,7 +53,7 @@ if [ $# -eq 0 ]; then
exit_with_usage
fi
-if [[ $@ == *"help"* ]]; then
+if [[ "$*" == *"help"* ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path: dev/make-distribution.sh
##########
@@ -123,26 +123,26 @@ fi
if [ ! "$(command -v "$MVN")" ] ; then
echo -e "Could not locate Maven command: '$MVN'."
echo -e "Specify the Maven command with the --mvn flag"
- exit -1;
+ exit 255;
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: python/run-tests
##########
@@ -24,7 +24,7 @@ cd "$FWDIR"
PYTHON_VERSION_CHECK=$(python3 -c 'import sys; print(sys.version_info < (3, 6,
0))')
if [[ "$PYTHON_VERSION_CHECK" == "True" ]]; then
echo "Python versions prior to 3.6 are not supported."
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/create-release/release-build.sh
##########
@@ -181,7 +181,7 @@ BASE_PROFILES="-Pmesos -Pyarn -Pkubernetes"
PUBLISH_SCALA_2_13=1
SCALA_2_13_PROFILES="-Pscala-2.13"
-if [[ $SPARK_VERSION < "3.2" ]]; then
+if [ "$(echo $SPARK_VERSION | awk -F "." '{if ($1 <= 3 && $2 < 2) print $1}')"
]; then
Review comment:
SC2072 (error): Decimals are not supported. Either use integers only, or
use bc or awk to compare.
##########
File path: dev/create-release/release-util.sh
##########
@@ -53,7 +53,7 @@ function run_silent {
echo "========================"
echo "= $BANNER"
- echo "Command: $@"
+ echo "Command: $*"
Review comment:
SC2145 (error): Argument mixes string and array. Use * or separate
argument.
##########
File path: dev/run-tests
##########
@@ -23,7 +23,7 @@ cd "$FWDIR"
PYTHON_VERSION_CHECK=$(python3 -c 'import sys; print(sys.version_info < (3, 6,
0))')
if [[ "$PYTHON_VERSION_CHECK" == "True" ]]; then
echo "Python versions prior to 3.6 are not supported."
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: dev/run-pip-tests
##########
@@ -105,7 +105,7 @@ for python in "${PYTHON_EXECS[@]}"; do
sdists=(*.tar.gz)
if [ ${#sdists[@]} -ne 1 ]; then
echo "Unexpected number of targets found in dist directory - please
cleanup existing sdists first."
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: sbin/spark-daemon.sh
##########
@@ -82,7 +82,7 @@ spark_rotate_log ()
num=${SPARK_LOG_MAX_FILES}
else
echo "Error: SPARK_LOG_MAX_FILES must be a positive number, but got
${SPARK_LOG_MAX_FILES}"
- exit -1
+ exit 255
Review comment:
SC2242 (error): Can only exit with status 0-255. Other data should be
written to stdout/stderr.
##########
File path: sbin/spark-config.sh
##########
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
Review comment:
SC2148 (error): Tips depend on target shell and yours is unknown. Add a
shebang or a 'shell' directive.
##########
File path: sbin/start-history-server.sh
##########
@@ -32,7 +32,7 @@ fi
# Any changes need to be reflected there.
CLASS="org.apache.spark.deploy.history.HistoryServer"
-if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
+if [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path: dev/test-dependencies.sh
##########
@@ -119,7 +119,7 @@ for HADOOP_HIVE_PROFILE in "${HADOOP_HIVE_PROFILES[@]}"; do
}' | sort | grep -v spark > dev/pr-deps/spark-deps-$HADOOP_HIVE_PROFILE
done
-if [[ $@ == **replace-manifest** ]]; then
+if [[ "$*" == **replace-manifest** ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path: sbin/start-worker.sh
##########
@@ -39,7 +39,7 @@ fi
# Any changes need to be reflected there.
CLASS="org.apache.spark.deploy.worker.Worker"
-if [[ $# -lt 1 ]] || [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
+if [[ $# -lt 1 ]] || [[ "$*" = *--help ]] || [[ "$*" = *-h ]]; then
Review comment:
SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or
explicit * instead of @).
##########
File path: dev/create-release/release-build.sh
##########
@@ -341,8 +341,8 @@ if [[ "$1" == "package" ]]; then
fi
if [[ $PUBLISH_SCALA_2_12 = 1 ]]; then
- echo "Packages to build: ${!BINARY_PKGS_ARGS[@]}"
- for key in ${!BINARY_PKGS_ARGS[@]}; do
+ echo "Packages to build: ${!BINARY_PKGS_ARGS[*]}"
Review comment:
SC2145 (error): Argument mixes string and array. Use * or separate
argument.
##########
File path: build/sbt-launch-lib.bash
##########
@@ -186,7 +186,7 @@ run() {
${SBT_OPTS:-$default_sbt_opts} \
$(get_mem_opts $sbt_mem) \
${java_opts} \
- ${java_args[@]} \
+ "${java_args[@]}" \
Review comment:
SC2068 (error): Double quote array expansions to avoid re-splitting
elements.
##########
File path: dev/make-distribution.sh
##########
@@ -170,24 +170,28 @@ BUILD_COMMAND=("$MVN" clean package -DskipTests $@)
# Actually build the jar
echo -e "\nBuilding with..."
-echo -e "\$ ${BUILD_COMMAND[@]}\n"
+echo -e "\$ ${BUILD_COMMAND[*]}\n"
Review comment:
SC2145 (error): Argument mixes string and array. Use * or separate
argument.
##########
File path: dev/create-release/release-build.sh
##########
@@ -341,8 +341,8 @@ if [[ "$1" == "package" ]]; then
fi
if [[ $PUBLISH_SCALA_2_12 = 1 ]]; then
- echo "Packages to build: ${!BINARY_PKGS_ARGS[@]}"
- for key in ${!BINARY_PKGS_ARGS[@]}; do
+ echo "Packages to build: ${!BINARY_PKGS_ARGS[*]}"
+ for key in "${!BINARY_PKGS_ARGS[@]}"; do
Review comment:
SC2068 (error): Double quote array expansions to avoid re-splitting
elements.
##########
File path: dev/make-distribution.sh
##########
@@ -123,26 +123,26 @@ fi
if [ ! "$(command -v "$MVN")" ] ; then
echo -e "Could not locate Maven command: '$MVN'."
echo -e "Specify the Maven command with the --mvn flag"
- exit -1;
+ exit 255;
fi
-VERSION=$("$MVN" help:evaluate -Dexpression=project.version $@ \
+VERSION=$("$MVN" help:evaluate -Dexpression=project.version "$@" \
Review comment:
SC2068 (error): Double quote array expansions to avoid re-splitting
elements.
##########
File path: sql/core/src/test/scripts/gen-avro.sh
##########
@@ -22,7 +24,7 @@ cd -
rm -rf $BASEDIR/gen-java
mkdir -p $BASEDIR/gen-java
-for input in `ls $BASEDIR/avro/*.avdl`; do
+for input in $BASEDIR/avro/*.avdl; do
Review comment:
SC2045 (error): Iterating over ls output is fragile. Use globs.
##########
File path: dev/make-distribution.sh
##########
@@ -170,24 +170,28 @@ BUILD_COMMAND=("$MVN" clean package -DskipTests $@)
# Actually build the jar
echo -e "\nBuilding with..."
-echo -e "\$ ${BUILD_COMMAND[@]}\n"
+echo -e "\$ ${BUILD_COMMAND[*]}\n"
"${BUILD_COMMAND[@]}"
# Make directories
rm -rf "$DISTDIR"
mkdir -p "$DISTDIR/jars"
echo "Spark $VERSION$GITREVSTRING built for Hadoop $SPARK_HADOOP_VERSION" >
"$DISTDIR/RELEASE"
-echo "Build flags: $@" >> "$DISTDIR/RELEASE"
+echo "Build flags: $*" >> "$DISTDIR/RELEASE"
# Copy jars
cp "$SPARK_HOME"/assembly/target/scala*/jars/* "$DISTDIR/jars/"
# Only create the yarn directory if the yarn artifacts were built.
-if [ -f
"$SPARK_HOME"/common/network-yarn/target/scala*/spark-*-yarn-shuffle.jar ]; then
- mkdir "$DISTDIR/yarn"
- cp "$SPARK_HOME"/common/network-yarn/target/scala*/spark-*-yarn-shuffle.jar
"$DISTDIR/yarn"
-fi
+for file in
"$SPARK_HOME"/common/network-yarn/target/scala*/spark-*-yarn-shuffle.jar
Review comment:
SC2144 (error): -f doesn't work with globs. Use a for loop.
##########
File path: sql/core/src/test/scripts/gen-avro.sh
##########
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
Review comment:
SC2148 (error): Tips depend on target shell and yours is unknown. Add a
shebang or a 'shell' directive.
##########
File path: sql/core/src/test/scripts/gen-thrift.sh
##########
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
Review comment:
SC2148 (error): Tips depend on target shell and yours is unknown. Add a
shebang or a 'shell' directive.
##########
File path:
resource-managers/kubernetes/integration-tests/dev/dev-run-integration-tests.sh
##########
@@ -200,5 +200,5 @@ properties+=(
-P$HADOOP_PROFILE \
-Pkubernetes \
-Pkubernetes-integration-tests \
- ${properties[@]}
+ "${properties[@]}"
Review comment:
SC2068 (error): Double quote array expansions to avoid re-splitting
elements.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]