btrfs: fix local array declarations
authorFilipe Manana <fdmanana@suse.com>
Fri, 21 Apr 2017 15:00:52 +0000 (16:00 +0100)
committerEryu Guan <eguan@redhat.com>
Mon, 24 Apr 2017 10:01:33 +0000 (18:01 +0800)
commit255affa11c14289ae896de38d3bcf58fc9f0679e
tree2edf9942897f5e2548b316d8ff3d83d534052b32
parent2385c5b4e8cbc47c7935c6cabd91d091f98327de
btrfs: fix local array declarations

We were declaring local arrays using a notation that does not seem to be
standard resulting in failures on some systems, like for example in a
Debian Stretch installation with bash version 4.4.11(1)-release:

$ ./check btrfs/003 btrfs/027
FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 debian3 4.10.0-rc8-btrfs-next-37+
MKFS_OPTIONS  -- /dev/sdc
MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

btrfs/003 45s ... [failed, exit status 1] - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/003.out.bad)
    --- tests/btrfs/003.out 2016-08-23 10:17:35.027012095 +0100
    +++ /home/fdmanana/git/hub/xfstests/results//btrfs/003.out.bad 2017-04-21 15:53:58.807366940 +0100
    @@ -1,2 +1,4 @@
     QA output created by 003
    -Silence is golden
    +./tests/btrfs/003: line 102: devs[]: bad array subscript
    +dev balance failed
    +(see /home/fdmanana/git/hub/xfstests/results//btrfs/003.full for details)
    ...
    (Run 'diff -u tests/btrfs/003.out /home/fdmanana/git/hub/xfstests/results//btrfs/003.out.bad'  to see the entire diff)
btrfs/027 7s ... [failed, exit status 1] - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/027.out.bad)
    --- tests/btrfs/027.out 2016-08-23 10:17:35.035012077 +0100
    +++ /home/fdmanana/git/hub/xfstests/results//btrfs/027.out.bad 2017-04-21 15:53:59.835367271 +0100
    @@ -1,2 +1,7 @@
     QA output created by 027
     Silence is golden
    +./common/rc: line 935: devs[]: bad array subscript
    +./common/rc: line 893: devs[]: bad array subscript
    +mkfs -m raid1 -d raid1 failed
    +Bug: str empty, must call _spare_dev_get before its put
    +(see /home/fdmanana/git/hub/xfstests/results//btrfs/027.full for details)
    ...
    (Run 'diff -u tests/btrfs/027.out /home/fdmanana/git/hub/xfstests/results//btrfs/027.out.bad'  to see the entire diff)
Ran: btrfs/003 btrfs/027
Failures: btrfs/003 btrfs/027
Failed 2 of 2 tests

So fix this by changing the declaration pattern "local dev[]=..." to the
standard way of "local -a dev=...".

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/rc
tests/btrfs/003