commit 2e42e8719e9c4133ce8c18304a9da4410ecd10f9
parent e51acc4a34a8fba83281d0f37337d57644d5282c
Author: Cem Keylan <cem@ckyln.com>
Date: Mon, 4 Jan 2021 12:44:36 +0300
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.
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git 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
)