Skip to content
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

Improve quoting of command line arguments for build/run scripts #1511

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build/build-in-docker
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

#
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,9 +45,9 @@ if [[ "$CCACHE_DISABLE" != "1" ]]; then
fi
fi

$SCRIPTDIR/run-in-docker "mvn \
$SCRIPTDIR/run-in-docker mvn \
-Dmaven.repo.local=$LOCAL_MAVEN_REPO \
-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=$CUDF_USE_PER_THREAD_DEFAULT_STREAM \
-DUSE_GDS=$USE_GDS \
$_CUDF_CLEAN_SKIP \
$*"
"$@"
2 changes: 1 addition & 1 deletion build/run-in-docker
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (( $# == 0 )); then
DOCKER_OPTS="${DOCKER_OPTS} -it"
RUN_CMD="/bin/bash"
else
RUN_CMD="$*"
RUN_CMD="${@@Q}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we would not need to build a string from an array if we used the alternative syntax https://access.redhat.com/documentation/en-us/red_hat_software_collections/3/html/packaging_guide/sect-enabling_the_software_collection
with -- on L77

 if (( $# == 0 )); then
   # no arguments gets an interactive shell
   DOCKER_OPTS="${DOCKER_OPTS} -it"
-  RUN_CMD="/bin/bash"
+  RUN_CMD=("/bin/bash")
 else
-  RUN_CMD="${@@Q}"
+  RUN_CMD=("$@")
 fi
...
-  scl enable devtoolset-11 "$RUN_CMD"
+  scl enable devtoolset-11 -- "${RUN_CMD[@]}"

fi

$DOCKER_CMD run $DOCKER_GPU_OPTS $DOCKER_RUN_EXTRA_ARGS -u $(id -u):$(id -g) --rm \
Expand Down