Fix quoting of local variable assignments throughout.
authorBrett Smith <brett@curoverse.com>
Sat, 2 Jan 2016 00:09:08 +0000 (19:09 -0500)
committerBrett Smith <brett@curoverse.com>
Mon, 11 Jan 2016 22:13:04 +0000 (17:13 -0500)
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
jenkins/run-tests.sh

index 69ebb0884e7f21fd27124b42c823096caabb4888..32a60990984f78b9894485e32c0c692de224d334 100755 (executable)
@@ -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
index a7b5fda0e74cc10d9acb0e13a05011787b67b1ec..bdf541af3c1577ed3f117ced4f1b1db7ffbb2ead 100755 (executable)
@@ -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