From ca5d25837608606b7a41c4eaa7bee930d96605d0 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 14 Nov 2024 17:49:36 +0100 Subject: [PATCH] test: shellcheck: use quotation marks --- test/lib/aux.sh | 4 +- test/shell/devicesfile-serial.sh | 56 +++++++++++------------ test/shell/dmeventd-restart.sh | 2 +- test/shell/lock-blocking.sh | 2 +- test/shell/lvconvert-raid-reshape-size.sh | 2 +- test/shell/udev-pvscan-vgchange.sh | 4 +- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/test/lib/aux.sh b/test/lib/aux.sh index c1549d118..bde642f3d 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -1089,9 +1089,9 @@ prepare_devs() { # then allocate a dedicated backing device for PV; otherwise, rollback # to use single backing device for device-mapper. if [ -n "$LVM_TEST_BACKING_DEVICE" ] && [ "$n" -le ${#BACKING_DEVICE_ARRAY[@]} ]; then - table[i]="0 $size linear "${BACKING_DEVICE_ARRAY[i]}" $(( header_shift * 2048 ))" + table[i]="0 $size linear ${BACKING_DEVICE_ARRAY[i]} $(( header_shift * 2048 ))" else - table[i]="0 $size linear "$BACKING_DEV" $(( i * size + ( header_shift * 2048 ) ))" + table[i]="0 $size linear $BACKING_DEV $(( i * size + ( header_shift * 2048 ) ))" fi concise[i]="$name,TEST-$name,,,${table[i]}" echo "${table[i]}" > "$name.table" diff --git a/test/shell/devicesfile-serial.sh b/test/shell/devicesfile-serial.sh index 3123e9ed6..fe447fc0c 100644 --- a/test/shell/devicesfile-serial.sh +++ b/test/shell/devicesfile-serial.sh @@ -196,10 +196,10 @@ vgcreate $vg2 "$dev2" vgcreate $vg3 "$dev3" vgcreate $vg4 "$dev4" cp "$DF" "$ORIG" -OPVID1=$(echo $(pvs --noheading -o uuid "$dev1") ) -OPVID2=$(echo $(pvs --noheading -o uuid "$dev2") ) -OPVID3=$(echo $(pvs --noheading -o uuid "$dev3") ) -OPVID4=$(echo $(pvs --noheading -o uuid "$dev4") ) +OPVID1="$(echo $(pvs --noheading -o uuid "$dev1") )" +OPVID2="$(echo $(pvs --noheading -o uuid "$dev2") )" +OPVID3="$(echo $(pvs --noheading -o uuid "$dev3") )" +OPVID4="$(echo $(pvs --noheading -o uuid "$dev4") )" PVID1=${OPVID1//-/} PVID2=${OPVID2//-/} PVID3=${OPVID3//-/} @@ -345,10 +345,10 @@ vgcreate $vg2 "$dev2" vgcreate $vg3 "$dev3" vgcreate $vg4 "$dev4" cp "$DF" "$ORIG" -OPVID1=$(echo $(pvs --noheading -o uuid "$dev1") ) -OPVID2=$(echo $(pvs --noheading -o uuid "$dev2") ) -OPVID3=$(echo $(pvs --noheading -o uuid "$dev3") ) -OPVID4=$(echo $(pvs --noheading -o uuid "$dev4") ) +OPVID1="$(echo $(pvs --noheading -o uuid "$dev1") )" +OPVID2="$(echo $(pvs --noheading -o uuid "$dev2") )" +OPVID3="$(echo $(pvs --noheading -o uuid "$dev3") )" +OPVID4="$(echo $(pvs --noheading -o uuid "$dev4") )" PVID1=${OPVID1//-/} PVID2=${OPVID2//-/} PVID3=${OPVID3//-/} @@ -472,8 +472,8 @@ touch "$DF" vgcreate $vg1 "$dev1" vgcreate $vg4 "$dev4" cp "$DF" "$ORIG" -OPVID1=$(echo $(pvs --noheading -o uuid "$dev1") ) -OPVID4=$(echo $(pvs --noheading -o uuid "$dev4") ) +OPVID1="$(echo $(pvs --noheading -o uuid "$dev1") )" +OPVID4="$(echo $(pvs --noheading -o uuid "$dev4") )" PVID1=${OPVID1//-/} PVID4=${OPVID4//-/} @@ -551,7 +551,7 @@ rm "$DF" touch "$DF" vgcreate $vg2 "$dev2" cp "$DF" "$ORIG" -OPVID2=$(echo $(pvs --noheading -o uuid "$dev2") ) +OPVID2="$(echo $(pvs --noheading -o uuid "$dev2") )" PVID2=${OPVID2//-/} grep "$PVID2" "$DF" |tee out @@ -601,10 +601,10 @@ grep "$SERIAL1" "$DF" grep "$SERIAL2" "$DF" grep "$SERIAL3" "$DF" grep "$SERIAL4" "$DF" -OPVID1=$(echo $(pvs --noheading -o uuid "$dev1") ) -OPVID2=$(echo $(pvs --noheading -o uuid "$dev2") ) -OPVID3=$(echo $(pvs --noheading -o uuid "$dev3") ) -OPVID4=$(echo $(pvs --noheading -o uuid "$dev4") ) +OPVID1="$(echo $(pvs --noheading -o uuid "$dev1") )" +OPVID2="$(echo $(pvs --noheading -o uuid "$dev2") )" +OPVID3="$(echo $(pvs --noheading -o uuid "$dev3") )" +OPVID4="$(echo $(pvs --noheading -o uuid "$dev4") )" PVID1=${OPVID1//-/} PVID2=${OPVID2//-/} PVID3=${OPVID3//-/} @@ -665,10 +665,10 @@ vgcreate $vg2 "$dev2" vgcreate $vg3 "$dev3" vgcreate $vg4 "$dev4" cp "$DF" "$ORIG" -OPVID1=$(echo $(pvs --noheading -o uuid "$dev1") ) -OPVID2=$(echo $(pvs --noheading -o uuid "$dev2") ) -OPVID3=$(echo $(pvs --noheading -o uuid "$dev3") ) -OPVID4=$(echo $(pvs --noheading -o uuid "$dev4") ) +OPVID1="$(echo $(pvs --noheading -o uuid "$dev1") )" +OPVID2="$(echo $(pvs --noheading -o uuid "$dev2") )" +OPVID3="$(echo $(pvs --noheading -o uuid "$dev3") )" +OPVID4="$(echo $(pvs --noheading -o uuid "$dev4") )" PVID1=${OPVID1//-/} PVID2=${OPVID2//-/} PVID3=${OPVID3//-/} @@ -730,9 +730,9 @@ vgcreate $vg1 "$dev1" vgcreate $vg2 "$dev2" vgcreate $vg3 "$dev3" cp "$DF" "$ORIG" -OPVID1=$(echo $(pvs --noheading -o uuid "$dev1") ) -OPVID2=$(echo $(pvs --noheading -o uuid "$dev2") ) -OPVID3=$(echo $(pvs --noheading -o uuid "$dev3") ) +OPVID1="$(echo $(pvs --noheading -o uuid "$dev1") )" +OPVID2="$(echo $(pvs --noheading -o uuid "$dev2") )" +OPVID3="$(echo $(pvs --noheading -o uuid "$dev3") )" PVID1=${OPVID1//-/} PVID2=${OPVID2//-/} PVID3=${OPVID3//-/} @@ -830,10 +830,10 @@ grep "$dev4" out grep "$dev2" out grep "$dev3" out -OPVID1=$(echo $(pvs --noheading -o uuid "$dev1") ) -OPVID2=$(echo $(pvs --noheading -o uuid "$dev2") ) -OPVID3=$(echo $(pvs --noheading -o uuid "$dev3") ) -OPVID4=$(echo $(pvs --noheading -o uuid "$dev4") ) +OPVID1="$(echo $(pvs --noheading -o uuid "$dev1") )" +OPVID2="$(echo $(pvs --noheading -o uuid "$dev2") )" +OPVID3="$(echo $(pvs --noheading -o uuid "$dev3") )" +OPVID4="$(echo $(pvs --noheading -o uuid "$dev4") )" PVID1=${OPVID1//-/} PVID2=${OPVID2//-/} PVID3=${OPVID3//-/} @@ -867,8 +867,8 @@ lvmdevices --adddev "$dev3" cat "$DF" cp "$DF" "$ORIG" -OPVID1=$(echo $(pvs --noheading -o uuid "$dev1") ) -OPVID2=$(echo $(pvs --noheading -o uuid "$dev2") ) +OPVID1="$(echo $(pvs --noheading -o uuid "$dev1") )" +OPVID2="$(echo $(pvs --noheading -o uuid "$dev2") )" PVID1=${OPVID1//-/} PVID2=${OPVID2//-/} diff --git a/test/shell/dmeventd-restart.sh b/test/shell/dmeventd-restart.sh index 5ef311400..3fb01df97 100644 --- a/test/shell/dmeventd-restart.sh +++ b/test/shell/dmeventd-restart.sh @@ -81,7 +81,7 @@ for i in {1..10}; do # wait here for a while until dmeventd dies.... # surprisingly it's not instant and we can actually # obtain list of monitored devices... - test -z $(ps -p "$pid" -o comm=) && break + test -z "$(ps -p "$pid" -o comm=)" && break sleep .1 done rm LOCAL_DMEVENTD debug.log* diff --git a/test/shell/lock-blocking.sh b/test/shell/lock-blocking.sh index ae38b01e9..5ba9c9bfe 100644 --- a/test/shell/lock-blocking.sh +++ b/test/shell/lock-blocking.sh @@ -47,7 +47,7 @@ not vgremove --config 'global { wait_for_locks = 0 }' $vg test -f "$TESTDIR/var/lock/lvm/P_global" # still running # First kill 'sleep' process forked from flock # Not using 'flock -F' since this flag is newer -kill $(ps -o pid --no-headers --ppid "$flock_pid") || true +kill "$(ps -o pid --no-headers --ppid "$flock_pid")" || true kill "$flock_pid" || true vgremove -ff $vg diff --git a/test/shell/lvconvert-raid-reshape-size.sh b/test/shell/lvconvert-raid-reshape-size.sh index 19b58515a..36291abcd 100644 --- a/test/shell/lvconvert-raid-reshape-size.sh +++ b/test/shell/lvconvert-raid-reshape-size.sh @@ -105,7 +105,7 @@ function _check_size local data_stripes=$3 # Compare size of LV with calculated one - [ $(blockdev --getsz /dev/$vg/$lv) -eq $(_get_size $vg $lv $data_stripes) ] && echo 0 || echo 1 + [ "$(blockdev --getsz /dev/$vg/$lv)" -eq "$(_get_size $vg $lv $data_stripes)" ] && echo 0 || echo 1 } function _total_stripes diff --git a/test/shell/udev-pvscan-vgchange.sh b/test/shell/udev-pvscan-vgchange.sh index 9e2faccf9..752c4a189 100644 --- a/test/shell/udev-pvscan-vgchange.sh +++ b/test/shell/udev-pvscan-vgchange.sh @@ -388,8 +388,8 @@ wait_md_create "$mddev" vgcreate $vg9 "$mddev" lvmdevices --adddev "$mddev" || true -PVIDMD=$(pvs "$mddev" --noheading -o uuid | tr -d - | awk '{print $1}') -BDEVMD=$(basename "$mddev") +PVIDMD="$(pvs "$mddev" --noheading -o uuid | tr -d - | awk '{print $1}')" +BDEVMD="$(basename "$mddev")" lvcreate -l1 -an -n $lv1 $vg9 lvcreate -l1 -an -n $lv2 $vg9 -- 2.43.5