Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] fstests: support new mkfs.btrfs help string
@ 2026-05-10  0:17 Qu Wenruo
  2026-05-10 19:09 ` Zorro Lang
  0 siblings, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2026-05-10  0:17 UTC (permalink / raw)
  To: fstests, linux-btrfs; +Cc: Shin'ichiro Kawasaki

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

Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/linux-btrfs/af9EHC5b-aBdr1zn@shinmob/
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 common/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/config b/common/config
index 1420e35d..339f7767 100644
--- a/common/config
+++ b/common/config
@@ -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
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] fstests: support new mkfs.btrfs help string
  2026-05-10  0:17 [PATCH] fstests: support new mkfs.btrfs help string Qu Wenruo
@ 2026-05-10 19:09 ` Zorro Lang
  2026-05-10 21:48   ` Qu Wenruo
  0 siblings, 1 reply; 4+ messages in thread
From: Zorro Lang @ 2026-05-10 19:09 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: fstests, linux-btrfs, Shin'ichiro Kawasaki

On Sun, May 10, 2026 at 09:47:04AM +0930, Qu Wenruo wrote:
> [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".
> 
> Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> Link: https://lore.kernel.org/linux-btrfs/af9EHC5b-aBdr1zn@shinmob/
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  common/config | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/config b/common/config
> index 1420e35d..339f7767 100644
> --- a/common/config
> +++ b/common/config
> @@ -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:

Reviewed-by: Zorro Lang <zlang@kernel.org>

>  		echo "$p -f"
>  	else
>  		echo $p
> -- 
> 2.51.2
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fstests: support new mkfs.btrfs help string
  2026-05-10 19:09 ` Zorro Lang
@ 2026-05-10 21:48   ` Qu Wenruo
  2026-05-11  0:47     ` Zorro Lang
  0 siblings, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2026-05-10 21:48 UTC (permalink / raw)
  To: Qu Wenruo, fstests, linux-btrfs, Shin'ichiro Kawasaki



在 2026/5/11 04:39, Zorro Lang 写道:
> On Sun, May 10, 2026 at 09:47:04AM +0930, Qu Wenruo wrote:
>> [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".
>>
>> Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>> Link: https://lore.kernel.org/linux-btrfs/af9EHC5b-aBdr1zn@shinmob/
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>> ---
>>   common/config | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/common/config b/common/config
>> index 1420e35d..339f7767 100644
>> --- a/common/config
>> +++ b/common/config
>> @@ -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.

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

> 
> 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 <zlang@kernel.org>
> 
>>   		echo "$p -f"
>>   	else
>>   		echo $p
>> -- 
>> 2.51.2
>>
>>
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fstests: support new mkfs.btrfs help string
  2026-05-10 21:48   ` Qu Wenruo
@ 2026-05-11  0:47     ` Zorro Lang
  0 siblings, 0 replies; 4+ messages in thread
From: Zorro Lang @ 2026-05-11  0:47 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: Qu Wenruo, fstests, linux-btrfs, Shin'ichiro Kawasaki

On Mon, May 11, 2026 at 07:18:44AM +0930, Qu Wenruo wrote:
> 
> 
> 在 2026/5/11 04:39, Zorro Lang 写道:
> > On Sun, May 10, 2026 at 09:47:04AM +0930, Qu Wenruo wrote:
> > > [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".
> > > 
> > > Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> > > Link: https://lore.kernel.org/linux-btrfs/af9EHC5b-aBdr1zn@shinmob/
> > > Signed-off-by: Qu Wenruo <wqu@suse.com>
> > > ---
> > >   common/config | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/common/config b/common/config
> > > index 1420e35d..339f7767 100644
> > > --- a/common/config
> > > +++ b/common/config
> > > @@ -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.
> 
> 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".

Great! I agree that's a proper change.

> 
> Thanks,
> Qu
> 
> > 
> > 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 <zlang@kernel.org>

Merged.

> > 
> > >   		echo "$p -f"
> > >   	else
> > >   		echo $p
> > > -- 
> > > 2.51.2
> > > 
> > > 
> > 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-11  0:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10  0:17 [PATCH] fstests: support new mkfs.btrfs help string Qu Wenruo
2026-05-10 19:09 ` Zorro Lang
2026-05-10 21:48   ` Qu Wenruo
2026-05-11  0:47     ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox