Janneke Nieuwenhuizen writes:

Hi!

> Josh Kilmer writes:
>
>> On Tue, May 19, 2026 at 12:21 AM Janneke Nieuwenhuizen <[email protected]> 
>> wrote:
>> [..]
>>>
>>> Find a patch attached.  Indeed, get/list xattrs return r >=0 upon
>>> success; so !r should be changed to r >0 even.  Please find a patch
>>> attached.
>>>
>>
>> Patch fixes it for me
>
> Great, thanks!  Attached is a patch to test the problem I found.

Come to think of it, testing gnu.* might be unwise because it might not
work on older kernels, and possibly only on linux and the hurd.

The problem was that the file-system didn't change, it's probably
enough to just test that aspect.

Find a new version attached.

Greetings,
Janneke

>From 3de83d5c85c754e34bcb33544ee481b693dbbebb Mon Sep 17 00:00:00 2001
From: Janneke Nieuwenhuizen <[email protected]>
Date: Wed, 20 May 2026 06:42:54 +0200
Subject: [PATCH v2] test: Add t.xattr2: Does fakeroot setfattr user.* change
 the file-system?

---
 test/Makefile.am |  3 ++-
 test/t.xattr2    | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100755 test/t.xattr2

diff --git a/test/Makefile.am b/test/Makefile.am
index 2445277..bdf9b4d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -15,7 +15,8 @@ TESTS =						\
   t.tar						\
   t.touchinstall				\
   t.truereturn					\
-  t.xattr
+  t.xattr					\
+  t.xattr2
 
 suffix =
 
diff --git a/test/t.xattr2 b/test/t.xattr2
new file mode 100755
index 0000000..dc1ade7
--- /dev/null
+++ b/test/t.xattr2
@@ -0,0 +1,26 @@
+#!/bin/sh
+. ./defs || exit 1
+
+# Skip the test if we can't find getfattr
+PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
+getfattr --version 2>/dev/null
+res=$?
+test "$res" -le 1 || exit 77
+
+mkdir $tmp
+touch $tmp/foo
+cat > $tmp/sh <<EOF
+setfattr --name=user.test --value=test $tmp/foo
+EOF
+run_fakeroot -- \
+  ${posixshell} $tmp/sh >$tmp/set.out
+
+# Did fakeroot setfattr actually make it onto the file-system?
+cat > $tmp/sh <<EOF
+getfattr --name=user.test $tmp/foo
+EOF
+run_fakeroot -- \
+  ${posixshell} $tmp/sh >$tmp/get.out
+
+cat $tmp/get.out
+grep '^user.test="test"' $tmp/get.out
-- 
2.54.0

-- 
Janneke Nieuwenhuizen <[email protected]>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com

Reply via email to