[PATCH 1/1] test_handling_of_incorrect_existing_linux_xattrs: restrict to user.*

0 views
Skip to first unread message

Rob Browning

unread,
Jun 28, 2026, 2:05:14 PM (6 days ago) Jun 28
to bup-...@googlegroups.com
This was failing in the same environment where we previously
encountered a default posix1e ACL:

24679623ae18f0badc51c41fccb9aab47a59ae6c
test-empty-metadata: accommodate test fs with default posix1e acl

The test fails because test/foo ends up with a system.posix_acl_access
attribute. Since the test is only interested in user xattrs (hence
the remove_selinux filter), extend the filter to remove everything
except user.* and avoid the problem.

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---

Pushed to main.

test/int/test_metadata.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/int/test_metadata.py b/test/int/test_metadata.py
index 5f8a796a..b812cbf8 100644
--- a/test/int/test_metadata.py
+++ b/test/int/test_metadata.py
@@ -313,8 +313,9 @@ def test_restore_over_existing_target(tmpdir):


def test_handling_of_incorrect_existing_linux_xattrs(tmpdir):
- def remove_selinux(attrs):
- return list(filter(lambda i: not i in (b'security.selinux', ), attrs))
+ def user_attrs(attrs):
+ # drops security.selinux system.posix_acl_acess, etc.
+ return list(filter(lambda x: x.startswith(b'user.'), attrs))

os.chdir(tmpdir) # reverted by common_test_environment
if not setup_user_xattr_test_dir(b'test', b'testfs.img'):
@@ -326,15 +327,15 @@ def test_handling_of_incorrect_existing_linux_xattrs(tmpdir):
m = metadata.from_path(path, archive_path=path, save_symlinks=True)
xattr.set(path, b'baz', b'bax', namespace=xattr.NS_USER)
m.apply_to_path(path, restore_numeric_ids=False)
- WVPASSEQ(remove_selinux(xattr.list(path)), [b'user.foo'])
+ WVPASSEQ(user_attrs(xattr.list(path)), [b'user.foo'])
WVPASSEQ(xattr.get(path, b'user.foo'), b'bar')
xattr.set(path, b'foo', b'baz', namespace=xattr.NS_USER)
m.apply_to_path(path, restore_numeric_ids=False)
- WVPASSEQ(remove_selinux(xattr.list(path)), [b'user.foo'])
+ WVPASSEQ(user_attrs(xattr.list(path)), [b'user.foo'])
WVPASSEQ(xattr.get(path, b'user.foo'), b'bar')
xattr.remove(path, b'foo', namespace=xattr.NS_USER)
m.apply_to_path(path, restore_numeric_ids=False)
- WVPASSEQ(remove_selinux(xattr.list(path)), [b'user.foo'])
+ WVPASSEQ(user_attrs(xattr.list(path)), [b'user.foo'])
WVPASSEQ(xattr.get(path, b'user.foo'), b'bar')
finally:
if os.path.exists(b'testfs.img'):
--
2.47.3

Reply all
Reply to author
Forward
0 new messages