diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-06-18 12:07:09 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-16 13:49:57 -0400 |
commit | 7850874b1ef1b18de585be108e3be899d95a3a2a (patch) | |
tree | 173896aa05b68545672124dbe28b098fec98ee0a /test/test.d/sourceballs.sh | |
parent | 282bf65c81e278b9237b4c202d325642bc0aa1a3 (diff) |
Fix quoting around variables, especially arrays.
Other than pure quoting, this involved:
- swapping */@ for array access in a few places
- fiddling with printf in a pipeline
- replacing `$(echo ${array[@]})` with `${array[*]}`
- replacing `echo $(...)` with `...`
When searching for these things, I used the command:
grep -Prn --exclude-dir=.git '(?<!["=]|\[\[ |\[\[ -[zn] )\$(?!{?#|\(|\? )'
and ignored a bunch of false positives.
Diffstat (limited to 'test/test.d/sourceballs.sh')
-rwxr-xr-x | test/test.d/sourceballs.sh | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/test/test.d/sourceballs.sh b/test/test.d/sourceballs.sh index fdcf08c..1097ae0 100755 --- a/test/test.d/sourceballs.sh +++ b/test/test.d/sourceballs.sh @@ -1,6 +1,6 @@ #!/bin/bash -curdir=$(readlink -e $(dirname $0)) +curdir=$(readlink -e "$(dirname "$0")") . "${curdir}/../lib/common.inc" testSourceballs() { @@ -9,16 +9,16 @@ testSourceballs() { local pkgbase local arch - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - releasePackage extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + releasePackage extra "${pkgbase}" "${arch}" done done ../db-update ../cron-jobs/sourceballs - for pkgbase in ${pkgs[@]}; do - [ ! -r ${FTP_BASE}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + for pkgbase in "${pkgs[@]}"; do + [ ! -r "${FTP_BASE}/${SRCPOOL}/${pkgbase}"-*"${SRCEXT}" ] && fail "source package not found!" done } @@ -26,14 +26,14 @@ testAnySourceballs() { local pkgs=('pkg-any-a' 'pkg-any-b') local pkgbase - for pkgbase in ${pkgs[@]}; do - releasePackage extra ${pkgbase} any + for pkgbase in "${pkgs[@]}"; do + releasePackage extra "${pkgbase}" any done ../db-update ../cron-jobs/sourceballs - for pkgbase in ${pkgs[@]}; do - [ ! -r ${FTP_BASE}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + for pkgbase in "${pkgs[@]}"; do + [ ! -r "${FTP_BASE}/${SRCPOOL}/${pkgbase}"-*"${SRCEXT}" ] && fail "source package not found!" done } @@ -44,17 +44,17 @@ testSplitSourceballs() { local pkgbase local arch - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - releasePackage extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + releasePackage extra "${pkgbase}" "${arch}" done done ../db-update ../cron-jobs/sourceballs - for pkgbase in ${pkgs[@]}; do - [ ! -r ${FTP_BASE}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + for pkgbase in "${pkgs[@]}"; do + [ ! -r "${FTP_BASE}/${SRCPOOL}/${pkgbase}"-*"${SRCEXT}" ] && fail "source package not found!" done } @@ -64,21 +64,21 @@ testSourceballsCleanup() { local pkgbase local arch - for pkgbase in ${pkgs[@]}; do - for arch in ${arches[@]}; do - releasePackage extra ${pkgbase} ${arch} + for pkgbase in "${pkgs[@]}"; do + for arch in "${arches[@]}"; do + releasePackage extra "${pkgbase}" "${arch}" done done ../db-update ../cron-jobs/sourceballs - for arch in ${arches[@]}; do - ../db-remove extra ${arch} pkg-simple-a + for arch in "${arches[@]}"; do + ../db-remove extra "${arch}" pkg-simple-a done ../cron-jobs/sourceballs - [ -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-a-*${SRCEXT} ] && fail "source package was not removed!" - [ ! -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-b-*${SRCEXT} ] && fail "source package not found!" + [ -r "${FTP_BASE}/${SRCPOOL}/pkg-simple-a"-*"${SRCEXT}" ] && fail "source package was not removed!" + [ ! -r "${FTP_BASE}/${SRCPOOL}/pkg-simple-b"-*"${SRCEXT}" ] && fail "source package not found!" } . "${curdir}/../lib/shunit2" |