diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh index f10d13fb5..dffed4890 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh @@ -81,30 +81,28 @@ log_note "block 0 of $init_data has a DVA of $dva" size_str=$(sed -Ene 's/^.+ size=([^ ]+) .*$/\1/p' <<< "$output") log_note "block size $size_str" -vdev=$(echo "$dva" | cut -d: -f1) -offset=$(echo "$dva" | cut -d: -f2) -output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:d 2> /dev/null) +IFS=: read -r vdev offset _ <<< "$dva" +output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:d) echo $output | grep -q $pattern || log_fail "zdb -R :d failed to decompress the data properly" -output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr 2> /dev/null) +output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr) echo $output | grep -q $four_k || log_fail "zdb -R :dr failed to decompress the data properly" -output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr 2> /dev/null) +output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr) result=${#output} (( $result != $blksize)) && log_fail \ "zdb -R failed to decompress the data to the length (${#output} != $size_str)" # decompress using lsize -lsize=$(echo $size_str | cut -d/ -f1) -psize=$(echo $size_str | cut -d/ -f2) -output=$(zdb -R $TESTPOOL $vdev:$offset:$lsize:dr 2> /dev/null) +IFS=/ read -r lsize psize _ <<< "$size_str" +output=$(zdb -R $TESTPOOL $vdev:$offset:$lsize:dr) result=${#output} (( $result != $blksize)) && log_fail \ "zdb -R failed to decompress the data (length ${#output} != $blksize)" # Specifying psize will decompress successfully , but not always to full # lsize since zdb has to guess lsize incrementally. -output=$(zdb -R $TESTPOOL $vdev:$offset:$psize:dr 2> /dev/null) +output=$(zdb -R $TESTPOOL $vdev:$offset:$psize:dr) result=${#output} # convert psize to decimal psize_orig=$psize