1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-09 13:57:55 +03:00

shellcheck: updates

Ehance some shellcheck reported issues.
This commit is contained in:
Zdenek Kabelac 2021-04-22 23:22:01 +02:00
parent 6a099707c4
commit f678052385
7 changed files with 23 additions and 23 deletions

View File

@ -383,7 +383,7 @@ detect_device_size() {
test -n "$DEVSIZE" || error "Cannot read size of device \"$VOLUME\"."
SSSIZE=$("$BLOCKDEV" --getss "$VOLUME" || true)
test -n "$SSSIZE" || error "Cannot read sector size of device \"$VOLUME\"."
DEVSIZE=$(( $DEVSIZE * $SSSIZE ))
DEVSIZE=$(( DEVSIZE * SSSIZE ))
fi
}

View File

@ -163,7 +163,7 @@ if (( clustered )); then
{
for i in nodes status services; do
cap_i=$(echo "$i"|tr a-z A-Z)
cap_i=$(echo "$i"|tr "[:lower:]" "[:upper:]")
echo "$cap_i:"
echo "----------------------------------"
log "cman_tool $i 2>> \"$log\""

View File

@ -18,11 +18,11 @@
# following external commands are used throughout the script
# echo and test are internal in bash at least
RM=rm
BASENAME=basename
MKTEMP=mktemp
READLINK=readlink
GETOPT=getopt
RM="rm"
BASENAME="basename"
MKTEMP="mktemp"
READLINK="readlink"
GETOPT="getopt"
# user may override lvm location by setting LVM_BINARY
LVM=${LVM_BINARY:-lvm}
@ -145,7 +145,7 @@ do
shift
;;
-v|--verbose)
let VERBOSE_COUNT=VERBOSE_COUNT+1
VERBOSE_COUNT=$(( VERBOSE_COUNT + 1 ))
if [ -z "$VERBOSE" ]
then
VERBOSE="-v"

View File

@ -18,7 +18,7 @@ SKIP_WITH_CLVMD=1
. lib/inittest
# Unsupported with valgrid testing
test ${LVM_VALGRIND:-0} -eq 0 || skip "Unsupported with valgrind"
test "${LVM_VALGRIND:-0}" -eq 0 || skip "Unsupported with valgrind"
# NOTE: Some tests, namely anything with vdo, and
# api/dbus_test_lv_interface_cache_lv.sh, require larger PVs

View File

@ -586,7 +586,7 @@ teardown() {
}
# Remove any metadata archives and backups from this test on system
rm -f /etc/lvm/archive/${PREFIX}* /etc/lvm/backup/${PREFIX}*
rm -f /etc/lvm/archive/"${PREFIX}"* /etc/lvm/backup/"${PREFIX}"*
echo "ok"
}
@ -669,7 +669,7 @@ prepare_real_devs() {
aux extend_filter "a|$path|"
dd if=/dev/zero of="$path" bs=32k count=1
wipefs -a "$path" 2>/dev/null || true
done < $LVM_TEST_DEVICE_LIST
done < "$LVM_TEST_DEVICE_LIST"
fi
printf "%s\\n" "${REAL_DEVICES[@]}" > REAL_DEVICES
}
@ -810,9 +810,9 @@ cleanup_md_dev() {
# try to find and remove any DM device on top of cleaned MD
# assume /dev/mdXXX is 9:MINOR
local minor=${mddev##/dev/md}
for i in $(dmsetup table | grep 9:$minor | cut -d: -f1) ; do
dmsetup remove $i || {
dmsetup --force remove $i || true
for i in $(dmsetup table | grep 9:"$minor" | cut -d: -f1) ; do
dmsetup remove "$i" || {
dmsetup --force remove "$i" || true
}
done
@ -842,7 +842,7 @@ wipefs_a() {
shift
if test -n "$LVM_TEST_DEVICES_FILE"; then
lvmdevices --deldev $dev || true
lvmdevices --deldev "$dev" || true
fi
if test -f HAVE_WIPEFS ; then
@ -866,7 +866,7 @@ wipefs_a() {
fi
if test -n "$LVM_TEST_DEVICES_FILE"; then
lvmdevices --adddev $dev || true
lvmdevices --adddev "$dev" || true
fi
udev_wait
@ -954,10 +954,10 @@ prepare_devs() {
done
if test -n "$LVM_TEST_DEVICES_FILE"; then
mkdir -p $TESTDIR/etc/lvm/devices || true
rm $TESTDIR/etc/lvm/devices/system.devices || true
mkdir -p "$TESTDIR/etc/lvm/devices" || true
rm "$TESTDIR/etc/lvm/devices/system.devices" || true
for d in "${DEVICES[@]}"; do
lvmdevices --adddev $dev || true
lvmdevices --adddev "$dev" || true
done
fi

View File

@ -157,7 +157,7 @@ mirror_nonredundant() {
attr=$(get lv_field "$lv" attr)
(echo "$attr" | grep "^......m...$" >/dev/null) || {
if (echo "$attr" | grep "^o.........$" >/dev/null) &&
lvs -a $1 | grep -F "[${2}_mimage" >/dev/null; then
lvs -a "$1" | grep -F "[${2}_mimage" >/dev/null; then
echo "TEST WARNING: $lv is a snapshot origin and looks like a mirror,"
echo "assuming it is actually a mirror"
else
@ -439,7 +439,7 @@ raid_leg_status() {
# Ignore inconsisten raid status 0/xxxxx idle
for i in {100..0} ; do
st=( $(dmsetup status $1-$2) ) || die "Unable to get status of $vg/$lv1"
st=( $(dmsetup status "$1-$2") ) || die "Unable to get status of $vg/$lv1"
b=( $(echo "${st[6]}" | sed s:/:' ':) )
[ "${b[0]}" = "0" ] || {
test "${st[5]}" = "$3" || break
@ -448,7 +448,7 @@ raid_leg_status() {
sleep .1
done
die "$1-$2 status ${st[5]} != $3 ($st)"
die "$1-$2 status ${st[5]} != $3 (${st[*]})"
}
grep_dmsetup() {

View File

@ -279,7 +279,7 @@ prepare_test_vars() {
while read path; do
count=$(( count + 1 ))
eval "dev$count=\"$path\""
done < $LVM_TEST_DEVICE_LIST
done < "$LVM_TEST_DEVICE_LIST"
else
for i in {1..16}; do
eval "dev$i=\"$DM_DEV_DIR/mapper/${PREFIX}pv$i\""