Re: [PATCH 1/5] common/btrfs: fix awk field separator in _check_temp_fsid

Filipe Manana <[email protected]> Mon, 20 Jul 2026 17:44:46 +0100
Newsgroups org.kernel.vger.fstests,org.kernel.vger.linux-btrfs
Message-ID <CAL3q7H7dvTuj+cuemk9qo3YK5Hqec6nM94HaaLjBHnRDL1hwrw@mail.gmail.com>
On Mon, Jul 20, 2026 at 12:34 PM Johannes Thumshirn
<[email protected]> wrote:
>
> _check_temp_fsid() extracted the on-disk fsid with "awk -d\" \"",
> but -d is gawk's --dump-variables option, not a field separator.
> As a result awk tried to open a file named " " for writing and dumped
> its variable list, polluting the test output with messages like:
>
>   awk: warning: could not open ' ' for writing: Read-only file system
>   awk: warning: sending variable list to standard error
>   ARGC: 1
>   ARGIND: 0
>   ...
>
> which made btrfs/311 (the only test currently exercising this helper)
> fail. Use -F" " to set the field separator as intended.

This is all correct and makes sense.

I wonder why the test doesn't fail on my Debian box.
My awk is a symlink to gawk and the man page, as well as running 'awk
--help', confirms -d is to dump variables to a file and -F is the
field separator as you say here.

So I'm puzzled. Any idea?

>
> Signed-off-by: Johannes Thumshirn <[email protected]>
> ---
>  common/btrfs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/btrfs b/common/btrfs
> index 30288f07b61a..d477bd9e38ea 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -980,7 +980,7 @@ _check_temp_fsid()
>
>         # on disk fsid
>         fsid=$($BTRFS_UTIL_PROG inspect-internal dump-super $dev1 | \
> -                               grep ^fsid | $AWK_PROG -d" " '{print $2}')
> +                               grep ^fsid | $AWK_PROG -F" " '{print $2}')
>         echo -e "On disk fsid:\t\t$fsid" | sed -e "s/$fsid/FSID/g"
>
>         # Print FSID even if it is not the same as metadata_uuid because it has
> --
> 2.54.0
>
>