We get a number of failures if selinux is enabled:
! tmetadata.py:298 ['user.foo', 'security.selinux'] == ['user.foo'] FAILED
! tmetadata.py:302 ['user.foo', 'security.selinux'] == ['user.foo'] FAILED
! tmetadata.py:306 ['user.foo', 'security.selinux'] == ['user.foo'] FAILED
Filter out security.selinux to address that.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
from bup.metadata import xattr
if xattr:
from bup.metadata import xattr
if xattr:
+ def remove_selinux(attrs):
+ return list(filter(lambda i: not i in (b'security.selinux', ),
+ attrs))
+
@wvtest
def test_handling_of_incorrect_existing_linux_xattrs():
if not is_superuser() or detect_fakeroot():
@wvtest
def test_handling_of_incorrect_existing_linux_xattrs():
if not is_superuser() or detect_fakeroot():
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)
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(xattr.list(path), [b'user.foo'])
+ WVPASSEQ(remove_selinux(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(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(xattr.list(path), [b'user.foo'])
+ WVPASSEQ(remove_selinux(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(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(xattr.list(path), [b'user.foo'])
+ WVPASSEQ(remove_selinux(xattr.list(path)), [b'user.foo'])
WVPASSEQ(xattr.get(path, b'user.foo'), b'bar')
os.chdir(start_dir)
cleanup_testfs()
WVPASSEQ(xattr.get(path, b'user.foo'), b'bar')
os.chdir(start_dir)
cleanup_testfs()