From 5c596ba7a47942f42aa7b67509cf28ebb878d058 Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Wed, 3 Jan 2018 15:45:35 -0600 Subject: [PATCH] Eliminate trailing spaces in DISKS The zfs-tests.sh driver script could add spaces to the end of $DISKS which defeates shell-based parsing with constructs such as ${DISKS##* }. Reviewed-by: Brian Behlendorf Signed-off-by: Tim Chase Issue #6900 --- scripts/zfs-tests.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh index 38b01b8715..22ca31d614 100755 --- a/scripts/zfs-tests.sh +++ b/scripts/zfs-tests.sh @@ -505,7 +505,11 @@ if [ -z "${DISKS}" ]; then [ -f "$TEST_FILE" ] && fail "Failed file exists: ${TEST_FILE}" truncate -s "${FILESIZE}" "${TEST_FILE}" || fail "Failed creating: ${TEST_FILE} ($?)" - DISKS="$DISKS$TEST_FILE " + if [[ "$DISKS" ]]; then + DISKS="$DISKS $TEST_FILE" + else + DISKS="$TEST_FILE" + fi done # @@ -522,7 +526,11 @@ if [ -z "${DISKS}" ]; then fail "Failed: ${TEST_FILE} -> ${TEST_LOOPBACK}" LOOPBACKS="${LOOPBACKS}${TEST_LOOPBACK} " BASELOOPBACKS=$(basename "$TEST_LOOPBACK") - DISKS="$DISKS$BASELOOPBACKS " + if [[ "$DISKS" ]]; then + DISKS="$DISKS $BASELOOPBACKS" + else + DISKS="$BASELOOPBACKS" + fi done fi fi