]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs/205: Fix that b2 variable is treated as octal vaule
authorXiao Yang <yangx.jy@cn.fujitsu.com>
Mon, 12 Nov 2018 08:01:03 +0000 (16:01 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 18 Nov 2018 12:46:43 +0000 (20:46 +0800)
Running xfs/205 triggers the following error:
----------------------------------------------
QA output created by 205
+./tests/xfs/205: line 61: 098: value too great for base (error token is "098")
...
----------------------------------------------

If b2 variable is a 2-digit number beginning with 0(e.g. 098),
it will be treated as octal vaule instaed of decimal value.  We
try to declare it as decimal value forcely.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/205

index 9cc9b599ad48d575cc6546eb194b9029c4baa340..645e509a7898efa105fd31f11a56acdcd65ba606 100755 (executable)
@@ -54,7 +54,9 @@ _scratch_resvblks 1024 >> $seqres.full 2>&1
 blks=$(( ($(_get_available_space $SCRATCH_MNT) / $fsblksz) - 15 ))
 test $blks -gt 1100 || _notrun "not enough space"
 b1=$(echo $blks | sed -e 's/[0-9][0-9][0-9]$/000/g')
-b2=$(echo $blks | sed -e 's/^[0-9][0-9]//g')
+# in case b2 begins with '0' as '098' and being treated as octal number, force
+# it to be 10 based
+b2=$((10#$(echo $blks | sed -e 's/^[0-9][0-9]//g')))
 echo "blks: $blks b1: $b1 b2: $b2" >> $seqres.full
 dd if=/dev/zero of=$SCRATCH_MNT/fred bs=$fsblksz count=$((b1 - 1000)) 2>&1 | _filter_dd
 dd if=/dev/zero of=$SCRATCH_MNT/fred2 bs=$fsblksz count=$b2 2>&1 | _filter_dd