diff options
author | merakor <cem@ckyln.com> | 2021-01-04 09:44:36 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2021-01-04 09:44:36 +0000 |
commit | d0dacf8bec5a19a89eb1bcc64723c2d1d6c110ba (patch) | |
tree | 30da5327d537766fe6bdedfddbeccf073e8c1141 /src | |
parent | bd67b11a5787a02a605628aa222e737451330524 (diff) | |
download | cpt-d0dacf8bec5a19a89eb1bcc64723c2d1d6c110ba.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/cpt-lib.in | 10 |
1 files 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 ) |