From 78fabcfa0694ae8c81e1d5ec0e5dacaed533545e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 5 May 2017 18:41:08 -0400 Subject: Quote strings that shellcheck warns about. These changes are all strictly "slap some double-quotes in there". Anything more than that is not included in this commit. --- lib/common.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/common.sh b/lib/common.sh index 8f043e8..4a15d9a 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -79,7 +79,7 @@ cleanup() { if [[ -n ${WORKDIR:-} ]] && $_setup_workdir; then rm -rf "$WORKDIR" fi - exit ${1:-0} + exit "${1:-0}" } abort() { @@ -112,7 +112,7 @@ in_array() { local needle=$1; shift local item for item in "$@"; do - [[ $item = $needle ]] && return 0 # Found + [[ $item = "$needle" ]] && return 0 # Found done return 1 # Not Found } @@ -134,7 +134,7 @@ get_full_version() { else for i in pkgver pkgrel epoch; do local indirect="${i}_override" - eval $(declare -f package_$1 | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p") + eval "$(declare -f "package_$1" | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")" [[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\" done if (( ! epoch_override )); then @@ -155,9 +155,9 @@ lock() { eval "exec $1>"'"$2"' fi - if ! flock -n $1; then + if ! flock -n "$1"; then stat_busy "${@:3}" - flock $1 + flock "$1" stat_done fi } @@ -172,9 +172,9 @@ slock() { eval "exec $1>"'"$2"' fi - if ! flock -sn $1; then + if ! flock -sn "$1"; then stat_busy "${@:3}" - flock -s $1 + flock -s "$1" stat_done fi } @@ -184,6 +184,8 @@ slock() { ## lock_close() { local fd=$1 + # https://github.com/koalaman/shellcheck/issues/862 + # shellcheck disable=2034 exec {fd}>&- } -- cgit v1.2.3-54-g00ecf