fstests: support new mkfs.btrfs help string
PATCH 1/1 fstests: support new mkfs.btrfs help string
[BUG]
The latest btrfs-progs release v7.0 breaks a lot of tests, e.g. btrfs/003:
btrfs/003 55s ... [failed, exit status 1]- output mismatch (see /home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad)
--- tests/btrfs/003.out 2026-05-09 03:07:52.952213772 +0900
+++ /home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad 2026-05-09 23:32:17.595751435 +0900
@@ -1,2 +1,3 @@
QA output created by 003
-Silence is golden
+mkfs failed
+(see /home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.full for details)
...
(Run 'diff -u /home/kts/kernel-test-suite/src/xfstests/tests/btrfs/003.out /home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad' to see the entire diff)
[CAUSE]
Commit ec8324cc4b8b ("btrfs-progs: help: adjust alignment of text") from btrfs-progs changed the helpe string output format, the previous help string for "-f" option of mkfs.btrfs looks like this:
-f|--force force overwrite of existing filesystem
There were 4 spaces before the "-f", thus can be matched by "[[:space:]]-f[[:space]|,]".
But now the help string looks like:
-f, --force force overwrite of existing filesystem
Which removed the spaces at the beginning.
The existing regex to catch "-f" requires at least one space before "-f", now it doesn't match the new btrfs help string, and cause mkfs failure because we can not overwrite an existing scratch device without "-f" option.
[FIX]
Change the regex to allow no space before "-f".
--- common/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/config +1 -1
@@ -103,7 +103,7 @@ set_mkfs_prog_path_with_opts() # Note: mkfs.f2fs doesn't support the --help option yet, but it doesn't # matter since it also prints the help when an invalid option is given. if [ "$p" != "" ] && \ - $p --help |& grep -q "[[:space:]]-f[[:space:]|,]"; then + $p --help |& grep -q "[[:space:]]*-f[[:space:]|,]"; then echo "$p -f" else echo $p
Signature · 1 line
2.51.2
Quoted 51 lines · Qu Wenruo
[BUG]
The latest btrfs-progs release v7.0 breaks a lot of tests, e.g. btrfs/003:btrfs/003 55s ... [failed, exit status 1]- output mismatch (see
/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad)
--- tests/btrfs/003.out 2026-05-09 03:07:52.952213772 +0900
+++/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad2026-05-09 23:32:17.595751435 +0900
@@ -1,2 +1,3 @@
QA output created by 003
-Silence is golden
+mkfs failed
+(see/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.fullfor details)
...
(Run 'diff -u/home/kts/kernel-test-suite/src/xfstests/tests/btrfs/003.out/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad' to see the entire diff)[CAUSE]
Commitec8324cc4b8b("btrfs-progs: help: adjust alignment of text") from btrfs-progs changed the helpe string output format, the previous help string for "-f" option of mkfs.btrfs looks like this:-f|--force force overwrite of existing filesystem
There were 4 spaces before the "-f", thus can be matched by "[[:space:]]-f[[:space]|,]".
But now the help string looks like:
-f, --force force overwrite of existing filesystem
Which removed the spaces at the beginning.
The existing regex to catch "-f" requires at least one space before "-f", now it doesn't match the new btrfs help string, and cause mkfs failure because we can not overwrite an existing scratch device without "-f" option.
[FIX]
Change the regex to allow no space before "-f".Reported-by Shin'ichiro Kawasaki <[email protected]>Signed-off-by Qu Wenruo <[email protected]>--- common/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/config +0
-0
common/config set_mkfs_prog_path_with_opts() · line 106
Quoted 5 lines
common/config +1
-1@@ -103,7 +103,7 @@ set_mkfs_prog_path_with_opts() # Note: mkfs.f2fs doesn't support the --help option yet, but it doesn't # matter since it also prints the help when an invalid option is given. if [ "$p" != "" ] && \ - $p --help |& grep -q "[[:space:]]-f[[:space:]|,]"; then + $p --help |& grep -q "[[:space:]]*-f[[:space:]|,]"; then
Hi Qu,
This change looks good to me. But to be a bit nitpicky, the original "[[:space:]]-f" required *a* mandatory [space] before the -f, whereas "[[:space:]]*-f" allows for *zero* or more spaces. This changes the semantics slightly, but it makes sense if you're trying to match cases where -f appears at the very beginning of a line.
If that wasn't your intention or if you find this behavior unexpected, let me know :) Otherwise, I'd like to:
Quoted 7 lines
common/config +0
-0echo "$p -f" else echo $pSignature · 1 line
2.51.2
Quoted 60 lines · Zorro Lang
Quoted 51 lines · Qu Wenruo
[BUG]
The latest btrfs-progs release v7.0 breaks a lot of tests, e.g. btrfs/003:btrfs/003 55s ... [failed, exit status 1]- output mismatch (see
/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad)
--- tests/btrfs/003.out 2026-05-09 03:07:52.952213772 +0900
+++/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad2026-05-09 23:32:17.595751435 +0900
@@ -1,2 +1,3 @@
QA output created by 003
-Silence is golden
+mkfs failed
+(see/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.fullfor details)
...
(Run 'diff -u/home/kts/kernel-test-suite/src/xfstests/tests/btrfs/003.out/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad' to see the entire diff)[CAUSE]
Commitec8324cc4b8b("btrfs-progs: help: adjust alignment of text") from btrfs-progs changed the helpe string output format, the previous help string for "-f" option of mkfs.btrfs looks like this:-f|--force force overwrite of existing filesystem
There were 4 spaces before the "-f", thus can be matched by "[[:space:]]-f[[:space]|,]".
But now the help string looks like:
-f, --force force overwrite of existing filesystem
Which removed the spaces at the beginning.
The existing regex to catch "-f" requires at least one space before "-f", now it doesn't match the new btrfs help string, and cause mkfs failure because we can not overwrite an existing scratch device without "-f" option.
[FIX]
Change the regex to allow no space before "-f".Reported-by Shin'ichiro Kawasaki <[email protected]>Signed-off-by Qu Wenruo <[email protected]>--- common/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/config +0
-0common/config set_mkfs_prog_path_with_opts() · line 106
Quoted 5 lines
common/config +1
-1@@ -103,7 +103,7 @@ set_mkfs_prog_path_with_opts() # Note: mkfs.f2fs doesn't support the --help option yet, but it doesn't # matter since it also prints the help when an invalid option is given. if [ "$p" != "" ] && \ - $p --help |& grep -q "[[:space:]]-f[[:space:]|,]"; then + $p --help |& grep -q "[[:space:]]*-f[[:space:]|,]"; thenHi Qu,
Quoted 5 lines
This change looks good to me. But to be a bit nitpicky, the original "[[:space:]]-f" required *a* mandatory [space] before the -f, whereas "[[:space:]]*-f" allows for *zero* or more spaces. This changes the semantics slightly, but it makes sense if you're trying to match cases where -f appears at the very beginning of a line.
That's exactly my intention.
Also explained in the commit message:
The existing regex to catch "-f" requires at least one space before "-f", now it doesn't match the new btrfs help string,
And
Change the regex to allow no space before "-f".
Thanks,
Qu
Quoted 14 lines
If that wasn't your intention or if you find this behavior unexpected, let me know :) Otherwise, I'd like to:
Reviewed-by Zorro Lang <[email protected]>Quoted 7 lines
common/config +0
-0echo "$p -f" else echo $pSignature · 1 line
2.51.2
Quoted 72 lines · Qu Wenruo
Quoted 60 lines · Zorro Lang
Quoted 51 lines · Qu Wenruo
[BUG]
The latest btrfs-progs release v7.0 breaks a lot of tests, e.g. btrfs/003:btrfs/003 55s ... [failed, exit status 1]- output mismatch (see
/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad)
--- tests/btrfs/003.out 2026-05-09 03:07:52.952213772 +0900
+++/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad2026-05-09 23:32:17.595751435 +0900
@@ -1,2 +1,3 @@
QA output created by 003
-Silence is golden
+mkfs failed
+(see/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.fullfor details)
...
(Run 'diff -u/home/kts/kernel-test-suite/src/xfstests/tests/btrfs/003.out/home/kts/kernel-test-suite/src/xfstests/results//btrfs/003.out.bad' to see the entire diff)[CAUSE]
Commitec8324cc4b8b("btrfs-progs: help: adjust alignment of text") from btrfs-progs changed the helpe string output format, the previous help string for "-f" option of mkfs.btrfs looks like this:-f|--force force overwrite of existing filesystem
There were 4 spaces before the "-f", thus can be matched by "[[:space:]]-f[[:space]|,]".
But now the help string looks like:
-f, --force force overwrite of existing filesystem
Which removed the spaces at the beginning.
The existing regex to catch "-f" requires at least one space before "-f", now it doesn't match the new btrfs help string, and cause mkfs failure because we can not overwrite an existing scratch device without "-f" option.
[FIX]
Change the regex to allow no space before "-f".Reported-by Shin'ichiro Kawasaki <[email protected]>Signed-off-by Qu Wenruo <[email protected]>--- common/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/config +0
-0common/config set_mkfs_prog_path_with_opts() · line 106
Quoted 5 lines
common/config +1
-1@@ -103,7 +103,7 @@ set_mkfs_prog_path_with_opts() # Note: mkfs.f2fs doesn't support the --help option yet, but it doesn't # matter since it also prints the help when an invalid option is given. if [ "$p" != "" ] && \ - $p --help |& grep -q "[[:space:]]-f[[:space:]|,]"; then + $p --help |& grep -q "[[:space:]]*-f[[:space:]|,]"; thenHi Qu,
Quoted 5 lines
This change looks good to me. But to be a bit nitpicky, the original "[[:space:]]-f" required *a* mandatory [space] before the -f, whereas "[[:space:]]*-f" allows for *zero* or more spaces. This changes the semantics slightly, but it makes sense if you're trying to match cases where -f appears at the very beginning of a line.
That's exactly my intention.
Also explained in the commit message:
Quoted 6 lines
The existing regex to catch "-f" requires at least one space before "-f", now it doesn't match the new btrfs help string,
And
Change the regex to allow no space before "-f".
Great! I agree that's a proper change.
Quoted 9 lines
Thanks,
QuQuoted 5 lines
If that wasn't your intention or if you find this behavior unexpected, let me know :) Otherwise, I'd like to:
Reviewed-by Zorro Lang <[email protected]>
Merged.
Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
common/config +0
-0echo "$p -f" else echo $pSignature · 1 line
2.51.2