[PATCH v2] generic/062: filter setfattr --restore symlink-safety warning

Avinesh Kumar <[email protected]> Mon, 6 Jul 2026 21:13:26 +0200
Newsgroups org.kernel.vger.fstests
Message-ID <[email protected]>
From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 fix)[0] makes "setfattr --restore" warn when
used without -P and the dump contains a symlink, which generic/062 does.
The warning leaks into the compared output via the setfattr() wrapper
and fails the test. Adding -P isn't portable (older attr doesn't have it),
so filter the warning in the wrapper instead.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

Signed-off-by: Avinesh Kumar <[email protected]>
---
 tests/generic/062 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/generic/062 b/tests/generic/062
index 89659040..ddf0a478 100755
--- a/tests/generic/062
+++ b/tests/generic/062
@@ -30,7 +30,12 @@ getfattr()
 
 setfattr()
 {
-    $SETFATTR_PROG $@ 2>&1 | _filter_scratch
+    # attr >= 2.6.0 (CVE-2026-54371 fix) warns that "setfattr --restore" without
+    # -P/--physical is unsafe because it can traverse symlinks. Older attr does
+    # not accept -P, so just filter the warning to stay version-agnostic.
+    $SETFATTR_PROG $@ 2>&1 | \
+        sed -e '/^Warning: option --restore=file is unsafe without option/d' | \
+        _filter_scratch
 }
 
 _create_test_bed()
-- 
2.54.0