Skip to contentSkip to conversation

Quoting issues in Bash script `grub-fs-tester` causes F2FS test failure

PATCH In review Paul Menzel 4 participants 5 messages Aug 28, 2020 – Sep 18, 2020

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

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
index bc14a05ca..bfc425e1f 100644
@@ -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
#2 lore raw

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.

---
 tests/util/grub-fs-tester.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-fs-tester.in +0 -0
index bc14a05ca..bfc425e1f 100644

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

Acked-by
#3 lore raw

Re: [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.

---
 tests/util/grub-fs-tester.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-fs-tester.in +0 -0
index bc14a05ca..bfc425e1f 100644

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...

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

author Tested-by on v1 1/1
#4 lore raw

Re: [PATCH] tests: F2FS test should use MOUNTDEVICE like other tests.

In reply to Glenn Washburn

Dear 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.

---
  tests/util/grub-fs-tester.in | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-fs-tester.in +0 -0
index bc14a05ca..bfc425e1f 100644

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