From d0dacf8bec5a19a89eb1bcc64723c2d1d6c110ba Mon Sep 17 00:00:00 2001 From: merakor Date: Mon, 4 Jan 2021 09:44:36 +0000 Subject: pkg_get_base: fix shellcheck error on older versions Just so you know, the error is due to a bug on the older versions, but we still don't want checks to fail because of it. Installing newer versions of shellcheck takes too long on test containers that I am okay with fixing a faulty error. FossilOrigin-Name: 179ced7baf35e7eace835e1f7903ce72d2249e7ec6c809cfdd92ba7aa14b2517 --- src/cpt-lib.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cpt-lib.in b/src/cpt-lib.in index 4d81ffb..729b178 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -1830,9 +1830,13 @@ pkg_get_base() ( # cpt-base is an optional file, return with success if it doesn't exist. [ -f "$CPT_ROOT/etc/cpt-base" ] || return 0 nonl=$1; set -- - while read -r pkg _; do - [ "${pkg##\#*}" ] || continue - set -- "$@" "$pkg" + + # Older versions of shellcheck warns us that the variable is changing on the + # subshell. That is our purpose here, thank you very much. + # shellcheck disable=SC2030 + while read -r pkgname _; do + [ "${pkgname##\#*}" ] || continue + set -- "$@" "$pkgname" done < "$CPT_ROOT/etc/cpt-base" if [ "$nonl" ]; then printf '%s ' "$@"; else printf '%s\n' "$@"; fi ) -- cgit v1.2.3