[PATCH] fstests: generic/062: avoid warning from polluting the golden output

Qu Wenruo <[email protected]> Tue, 7 Jul 2026 18:29:30 +0930
Newsgroups org.kernel.vger.fstests,org.kernel.vger.linux-btrfs
Message-ID <7df0f6d0323abed08ffb1f40775474e4b39fef19.1783414762.git.wqu@suse.com>
[FAILURE]
With the latest setfattr (provided by attr 2.6.0), the test case
generic/062 will fail like the following:

 FSTYP         -- btrfs
 PLATFORM      -- Linux/aarch64 btrfs-aarch64 7.2.0-rc1-custom-64k+ #22 SMP PREEMPT_DYNAMIC Tue Jul  7 16:05:57 ACST 2026
 MKFS_OPTIONS  -- -O bgt -K /dev/mapper/test-scratch1
 MOUNT_OPTIONS -- /dev/mapper/test-scratch1 /mnt/scratch

 generic/062  1s ... - output mismatch (see /home/adam/xfstests-dev/results//generic/062.out.bad)
     --- tests/generic/062.out	2024-04-25 18:13:45.101553098 +0930
     +++ /home/adam/xfstests-dev/results//generic/062.out.bad	2026-07-07 18:22:12.384539920 +0930
     @@ -649,6 +649,7 @@
      SCRATCH_MNT/lnk
      SCRATCH_MNT/reg
      *** restore everything
     +Warning: option --restore=file is unsafe without option -P (--physical) as it traverses symbolic links in pathnames
      *** compare before and after backups

      *** unmount
     ...
     (Run 'diff -u /home/adam/xfstests-dev/tests/generic/062.out /home/adam/xfstests-dev/results//generic/062.out.bad'  to see the entire diff)
 Ran: generic/062
 Failures: generic/062
 Failed 1 of 1 tests

[CAUSE]
That output is a warning from the latest attr, introduced by attr commit
3fb06b9ba314 ("harden setfattr --restore").

There is also a compile time flag to toggle that warning.

[FIX]
Since we have no way to know if the setfattr command from the running
environment has that hardening or not, and the way to disable that
warning is to use "-P" option, which does not exist in older versions,
just redirect the stdout into seqres.full to avoid pollution.

Signed-off-by: Qu Wenruo <[email protected]>
---
 tests/generic/062 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/generic/062 b/tests/generic/062
index 896590403fda..faeb9650c608 100755
--- a/tests/generic/062
+++ b/tests/generic/062
@@ -186,7 +186,9 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+# For attr 2.6.0, --restore= without -P will output a warning.
+# Redirect it to avoid polluting the golden output.
+setfattr -h --restore=$tmp.backup1 >> $seqres.full
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
-- 
2.54.0