]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut): quote strip_cmd variable
authorBenjamin Drung <benjamin.drung@canonical.com>
Fri, 14 Jun 2024 13:38:21 +0000 (15:38 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Fri, 14 Jun 2024 18:04:31 +0000 (14:04 -0400)
shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `strip_cmd` refers to a path and therefore is safe to
be quoted.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
dracut.sh

index cc6d6f280ee08fe438ba86319eb67cb4b3a6b221..07575c6bbf0e3f0a6f3ce935d3a2af285f7b3141 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -2117,8 +2117,8 @@ if [[ $do_strip == yes ]]; then
     strip_cmd=$(command -v eu-strip)
     [ -z "$strip_cmd" ] && strip_cmd="strip"
 
-    for p in $strip_cmd xargs find; do
-        if ! type -P $p > /dev/null; then
+    for p in "$strip_cmd" xargs find; do
+        if ! type -P "$p" > /dev/null; then
             dinfo "Could not find '$p'. Not stripping the initramfs."
             do_strip=no
         fi
@@ -2269,14 +2269,14 @@ if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
     dinfo "*** Stripping files ***"
     find "$initdir" -type f \
         -executable -not -path '*/lib/modules/*.ko*' -print0 \
-        | xargs -r -0 $strip_cmd "${strip_args[@]}" 2> /dev/null
+        | xargs -r -0 "$strip_cmd" "${strip_args[@]}" 2> /dev/null
 
     # strip kernel modules, but do not touch signed modules
     find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
         | while read -r -d $'\0' f || [ -n "$f" ]; do
             SIG=$(tail -c 28 "$f" | tr -d '\000')
             [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
-        done | xargs -r -0 $strip_cmd "${strip_args[@]}"
+        done | xargs -r -0 "$strip_cmd" "${strip_args[@]}"
     dinfo "*** Stripping files done ***"
 fi