Re: [PATCH] xfs/083: redirect populate stderr to avoid spurious attr restore warnings

"Darrick J. Wong" <[email protected]> Fri, 10 Jul 2026 16:46:55 -0700
Newsgroups org.kernel.vger.fstests
Message-ID <20260710234655.GC15202@frogsfrogsfrogs>
On Fri, Jul 10, 2026 at 09:53:55PM +0200, Avinesh Kumar wrote:
> From: Avinesh Kumar <[email protected]>
> 
> attr 2.6.0 (CVE-2026-54371 fix)[0] makes "setfattr --restore" print warnings
> on stderr. _scratch_populate uses it, and xfs/083 only redirects stdout,
> so the warnings leak into the test output and fail it.
> Redirect stderr to $seqres.full too.
> 
> +Warning: option --restore=file is unsafe without option -P (--physical) as it traverses symbolic links in pathnames
> +Warning: option --restore=file is unsafe without option -h (--no-dereference) as it dereferences symbolic link pathnames
> 
> [0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8
> 
> Signed-off-by: Avinesh Kumar <[email protected]>
> ---
>  tests/xfs/083 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/xfs/083 b/tests/xfs/083
> index 9291c8c0..48deaafa 100755
> --- a/tests/xfs/083
> +++ b/tests/xfs/083
> @@ -91,7 +91,7 @@ echo "+ create scratch fs" >> $seqres.full
>  _scratch_mkfs_xfs >> $seqres.full 2>&1
>  
>  echo "+ populate fs image" >> $seqres.full
> -_scratch_populate >> $seqres.full
> +_scratch_populate >> $seqres.full 2>&1

That's quite an overbroad brush there -- we want any *unexpected*
errors to go to the .out file.  Given there are five users of setfattr
--restore flag:

$ git grep -i attr.*--restore
common/overlay:497:             _getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
common/populate:154:    ) | setfattr --restore -
common/populate:203:            ) | setfattr --restore -
tests/generic/062:189:setfattr -h --restore=$tmp.backup1
tests/xfs/227:75:       $SETFATTR_PROG --restore=$tmp.$1.attrs $2

Maaaaybe this should instead be a targeted wrapper for that?

_setfattr_restore()
{
	$SETFATTR_PROG --restore=- 2> $tmp.setfattr.$$
	local ret=$?
	cat $tmp.setfattr.$$ | sed -e '/--restore=.*unsafe.*without/d' 1>&2
	return $ret
}

--D

>  
>  echo "+ check fs" >> $seqres.full
>  _repair_scratch_fs >> $seqres.full 2>&1 || _fail "should pass initial fsck"
> -- 
> 2.54.0
> 
>