Quoting issues in Bash script `grub-fs-tester` causes F2FS test failure
Dear GRUB folks,
Running sudo env make -e check VERBOSE=yes SUBDIRS= the F2FS is one of the two tests failing. It returns 255.
Running only the specific test
sudo env TESTS=f2fs_test make -e check VERBOSE=yes SUBDIRS=
which runs
sudo ./grub-fs-tester f2fs
and using set -ex in grub-fs-tester the call below has quoting issues.
xf2fs)
"mkfs.f2fs" -l "$FSLABEL" -q "${LODEVICES[0]}"fails due to the loop device being passed in single quotes, which does not exist with the leading space.
+ LODEVICE=/dev/loop11
+ LODEVICES=' /dev/loop11'
+ mkfs.f2fs -l
'grub_;/testé䏌䐓䏕киритiurewfceniuewruewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoirvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoircreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoiq' -q ' /dev/loop11'
FAIL f2fs_test (exit status: 255)
Is there a Bash expert in here, able to fix it?
Kind regards,
Paul
PATCH 1/1 tests: F2FS test should use MOUNTDEVICE like other tests.
LODEVICES is not an array variable and should not be accessed as such. This allows the f2fs test to pass as it was failing because a device name had a space prepended to the path.
--- tests/util/grub-fs-tester.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-fs-tester.in +1 -1
@@ -796,7 +796,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do MOUNTFS=ext2 "mkfs.ext2" -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; xf2fs) - "mkfs.f2fs" -l "$FSLABEL" -q "${LODEVICES[0]}" ;; + "mkfs.f2fs" -l "$FSLABEL" -q "${MOUNTDEVICE}" ;; xnilfs2) "mkfs.nilfs2" -L "$FSLABEL" -b $BLKSIZE -q "${MOUNTDEVICE}" ;; xext2_old)
Signature · 1 line
2.27.0
Re: [PATCH] tests: F2FS test should use MOUNTDEVICE like other tests.
Adding Jaegeuk and Paul...
Quoted 14 lines · Glenn Washburn
LODEVICES is not an array variable and should not be accessed as such. This allows the f2fs test to pass as it was failing because a device name had a space prepended to the path.
Signed-off-by Glenn Washburn <[email protected]>--- tests/util/grub-fs-tester.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/util/grub-fs-tester.in +0
-0
tests/util/grub-fs-tester.in for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do · line 799
Quoted 5 lines
tests/util/grub-fs-tester.in +1
-1@@ -796,7 +796,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do MOUNTFS=ext2 "mkfs.ext2" -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; xf2fs) - "mkfs.f2fs" -l "$FSLABEL" -q "${LODEVICES[0]}" ;; + "mkfs.f2fs" -l "$FSLABEL" -q "${MOUNTDEVICE}" ;;
LGTM...
Jaegeuk, Paul does this fix work for you?
Daniel
Jaegeuk Kim
Acked-byRe: [PATCH] tests: F2FS test should use MOUNTDEVICE like other tests.
Quoted 25 lines · Daniel Kiper
Adding Jaegeuk and Paul...
Quoted 14 lines · Glenn Washburn
LODEVICES is not an array variable and should not be accessed as such. This allows the f2fs test to pass as it was failing because a device name had a space prepended to the path.
Signed-off-by Glenn Washburn <[email protected]>--- tests/util/grub-fs-tester.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/util/grub-fs-tester.in +0
-0tests/util/grub-fs-tester.in for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do · line 799
Quoted 5 lines
tests/util/grub-fs-tester.in +1
-1@@ -796,7 +796,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do MOUNTFS=ext2 "mkfs.ext2" -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; xf2fs) - "mkfs.f2fs" -l "$FSLABEL" -q "${LODEVICES[0]}" ;; + "mkfs.f2fs" -l "$FSLABEL" -q "${MOUNTDEVICE}" ;;LGTM...
Quoted 1 line
Jaegeuk, Paul does this fix work for you?
Thank you. I'm okay and should follow the others.
Quoted 2 lines
Daniel
Re: [PATCH] tests: F2FS test should use MOUNTDEVICE like other tests.
In reply to Glenn WashburnDear Glenn,
Am 29.08.20 um 01:30 schrieb Glenn Washburn:
Quoted 14 lines
LODEVICES is not an array variable and should not be accessed as such. This allows the f2fs test to pass as it was failing because a device name had a space prepended to the path.
Signed-off-by Glenn Washburn <[email protected]>--- tests/util/grub-fs-tester.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/util/grub-fs-tester.in +0
-0
tests/util/grub-fs-tester.in for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do · line 802
Quoted 8 lines
tests/util/grub-fs-tester.in +1
-1@@ -796,7 +796,7 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do MOUNTFS=ext2 "mkfs.ext2" -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; xf2fs) - "mkfs.f2fs" -l "$FSLABEL" -q "${LODEVICES[0]}" ;; + "mkfs.f2fs" -l "$FSLABEL" -q "${MOUNTDEVICE}" ;; xnilfs2) "mkfs.nilfs2" -L "$FSLABEL" -b $BLKSIZE -q "${MOUNTDEVICE}" ;; xext2_old)
Kind regards,
Paul