From 0814135175ab777abe515e4ba404dd0bf2929b24 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Fri, 1 Jan 2016 19:09:08 -0500 Subject: [PATCH] Fix quoting of local variable assignments throughout. When you assign a variable directly (e.g., `FOO=bar`), you don't need to quote the RHS, because the shell doesn't do expansion in that case. But when you declare and assign a variable (e.g., `local foo=bar`), you *do* potentially need to quote it, because `local` is a command and all the normal expansion rules for running commands applies. --- jenkins/run-library.sh | 16 ++++++++-------- jenkins/run-tests.sh | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jenkins/run-library.sh b/jenkins/run-library.sh index 69ebb0884e..32a6099098 100755 --- a/jenkins/run-library.sh +++ b/jenkins/run-library.sh @@ -28,7 +28,7 @@ EOF } format_last_commit_here() { - local format=$1; shift + local format="$1"; shift TZ=UTC git log -n1 --first-parent "--format=format:$format" . } @@ -59,8 +59,8 @@ handle_python_package () { } handle_ruby_gem() { - local gem_name=$1; shift - local gem_version=$(nohash_version_from_git) + local gem_name="$1"; shift + local gem_version="$(nohash_version_from_git)" local gem_src_dir="$(pwd)" if ! [[ -e "${gem_name}-${gem_version}.gem" ]]; then @@ -76,7 +76,7 @@ package_go_binary() { local src_path="$1"; shift local prog="$1"; shift local description="$1"; shift - local license_file=${1:-agpl-3.0.txt}; shift + local license_file="${1:-agpl-3.0.txt}"; shift debug_echo "package_go_binary $src_path as $prog" @@ -86,8 +86,8 @@ package_go_binary() { ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" cd "$GOPATH/src/git.curoverse.com/arvados.git/$src_path" - local version=$(version_from_git) - local timestamp=$(timestamp_from_git) + local version="$(version_from_git)" + local timestamp="$(timestamp_from_git)" # If the command imports anything from the Arvados SDK, bump the # version number and build a new package whenever the SDK changes. @@ -104,8 +104,8 @@ package_go_binary() { } default_iteration() { - local package_name=$1; shift - local package_version=$1; shift + local package_name="$1"; shift + local package_version="$1"; shift local iteration=1 if [[ $package_version =~ ^0\.1\.([0-9]{14})(\.|$) ]] && \ [[ ${BASH_REMATCH[1]} -le $LICENSE_PACKAGE_TS ]]; then diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh index a7b5fda0e7..bdf541af3c 100755 --- a/jenkins/run-tests.sh +++ b/jenkins/run-tests.sh @@ -393,7 +393,7 @@ gem_uninstall_if_exists() { } setup_virtualenv() { - local venvdest=$1; shift + local venvdest="$1"; shift if ! [[ -e "$venvdest/bin/activate" ]] || ! [[ -e "$venvdest/bin/pip" ]]; then virtualenv --setuptools "$@" "$venvdest" || fatal "virtualenv $venvdest failed" fi -- 2.30.2