|
@@ -340,14 +340,14 @@ class ArchiverTestCaseBase(BaseTestCase):
|
|
# This is because fakeroot with xattr-support does not propagate xattrs of the underlying file
|
|
# This is because fakeroot with xattr-support does not propagate xattrs of the underlying file
|
|
# into "fakeroot space". Because the xattrs exposed by borgfs are these of an underlying file
|
|
# into "fakeroot space". Because the xattrs exposed by borgfs are these of an underlying file
|
|
# (from fakeroots point of view) they are invisible to the test process inside the fakeroot.
|
|
# (from fakeroots point of view) they are invisible to the test process inside the fakeroot.
|
|
- xattr.setxattr(os.path.join(self.input_path, 'fusexattr'), 'user.foo', b'bar')
|
|
|
|
- xattr.setxattr(os.path.join(self.input_path, 'fusexattr'), 'user.empty', b'')
|
|
|
|
|
|
+ xattr.setxattr(os.path.join(self.input_path, 'fusexattr'), b'user.foo', b'bar')
|
|
|
|
+ xattr.setxattr(os.path.join(self.input_path, 'fusexattr'), b'user.empty', b'')
|
|
# XXX this always fails for me
|
|
# XXX this always fails for me
|
|
# ubuntu 14.04, on a TMP dir filesystem with user_xattr, using fakeroot
|
|
# ubuntu 14.04, on a TMP dir filesystem with user_xattr, using fakeroot
|
|
# same for newer ubuntu and centos.
|
|
# same for newer ubuntu and centos.
|
|
# if this is supported just on specific platform, platform should be checked first,
|
|
# if this is supported just on specific platform, platform should be checked first,
|
|
# so that the test setup for all tests using it does not fail here always for others.
|
|
# so that the test setup for all tests using it does not fail here always for others.
|
|
- # xattr.setxattr(os.path.join(self.input_path, 'link1'), 'user.foo_symlink', b'bar_symlink', follow_symlinks=False)
|
|
|
|
|
|
+ # xattr.setxattr(os.path.join(self.input_path, 'link1'), b'user.foo_symlink', b'bar_symlink', follow_symlinks=False)
|
|
# FIFO node
|
|
# FIFO node
|
|
if are_fifos_supported():
|
|
if are_fifos_supported():
|
|
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
|
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
|
@@ -1229,19 +1229,19 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
# We need to manually patch chown to get the behaviour Linux has, since fakeroot does not
|
|
# We need to manually patch chown to get the behaviour Linux has, since fakeroot does not
|
|
# accurately model the interaction of chown(2) and Linux capabilities, i.e. it does not remove them.
|
|
# accurately model the interaction of chown(2) and Linux capabilities, i.e. it does not remove them.
|
|
def patched_fchown(fd, uid, gid):
|
|
def patched_fchown(fd, uid, gid):
|
|
- xattr.setxattr(fd, 'security.capability', b'', follow_symlinks=False)
|
|
|
|
|
|
+ xattr.setxattr(fd, b'security.capability', b'', follow_symlinks=False)
|
|
fchown(fd, uid, gid)
|
|
fchown(fd, uid, gid)
|
|
|
|
|
|
# The capability descriptor used here is valid and taken from a /usr/bin/ping
|
|
# The capability descriptor used here is valid and taken from a /usr/bin/ping
|
|
capabilities = b'\x01\x00\x00\x02\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
|
|
capabilities = b'\x01\x00\x00\x02\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
|
|
self.create_regular_file('file')
|
|
self.create_regular_file('file')
|
|
- xattr.setxattr('input/file', 'security.capability', capabilities)
|
|
|
|
|
|
+ xattr.setxattr('input/file', b'security.capability', capabilities)
|
|
self.cmd('init', '--encryption=repokey', self.repository_location)
|
|
self.cmd('init', '--encryption=repokey', self.repository_location)
|
|
self.cmd('create', self.repository_location + '::test', 'input')
|
|
self.cmd('create', self.repository_location + '::test', 'input')
|
|
with changedir('output'):
|
|
with changedir('output'):
|
|
with patch.object(os, 'fchown', patched_fchown):
|
|
with patch.object(os, 'fchown', patched_fchown):
|
|
self.cmd('extract', self.repository_location + '::test')
|
|
self.cmd('extract', self.repository_location + '::test')
|
|
- assert xattr.getxattr('input/file', 'security.capability') == capabilities
|
|
|
|
|
|
+ assert xattr.getxattr('input/file', b'security.capability') == capabilities
|
|
|
|
|
|
@pytest.mark.skipif(not xattr.XATTR_FAKEROOT, reason='xattr not supported on this system or on this version of'
|
|
@pytest.mark.skipif(not xattr.XATTR_FAKEROOT, reason='xattr not supported on this system or on this version of'
|
|
'fakeroot')
|
|
'fakeroot')
|
|
@@ -1256,7 +1256,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
raise OSError(errno.EACCES, 'EACCES')
|
|
raise OSError(errno.EACCES, 'EACCES')
|
|
|
|
|
|
self.create_regular_file('file')
|
|
self.create_regular_file('file')
|
|
- xattr.setxattr('input/file', 'attribute', 'value')
|
|
|
|
|
|
+ xattr.setxattr('input/file', b'attribute', b'value')
|
|
self.cmd('init', self.repository_location, '-e' 'none')
|
|
self.cmd('init', self.repository_location, '-e' 'none')
|
|
self.cmd('create', self.repository_location + '::test', 'input')
|
|
self.cmd('create', self.repository_location + '::test', 'input')
|
|
with changedir('output'):
|
|
with changedir('output'):
|
|
@@ -2185,13 +2185,13 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
in_fn = 'input/fusexattr'
|
|
in_fn = 'input/fusexattr'
|
|
out_fn = os.path.join(mountpoint, 'input', 'fusexattr')
|
|
out_fn = os.path.join(mountpoint, 'input', 'fusexattr')
|
|
if not xattr.XATTR_FAKEROOT and xattr.is_enabled(self.input_path):
|
|
if not xattr.XATTR_FAKEROOT and xattr.is_enabled(self.input_path):
|
|
- assert sorted(no_selinux(xattr.listxattr(out_fn))) == ['user.empty', 'user.foo', ]
|
|
|
|
- assert xattr.getxattr(out_fn, 'user.foo') == b'bar'
|
|
|
|
- assert xattr.getxattr(out_fn, 'user.empty') == b''
|
|
|
|
|
|
+ assert sorted(no_selinux(xattr.listxattr(out_fn))) == [b'user.empty', b'user.foo', ]
|
|
|
|
+ assert xattr.getxattr(out_fn, b'user.foo') == b'bar'
|
|
|
|
+ assert xattr.getxattr(out_fn, b'user.empty') == b''
|
|
else:
|
|
else:
|
|
assert xattr.listxattr(out_fn) == []
|
|
assert xattr.listxattr(out_fn) == []
|
|
try:
|
|
try:
|
|
- xattr.getxattr(out_fn, 'user.foo')
|
|
|
|
|
|
+ xattr.getxattr(out_fn, b'user.foo')
|
|
except OSError as e:
|
|
except OSError as e:
|
|
assert e.errno == llfuse.ENOATTR
|
|
assert e.errno == llfuse.ENOATTR
|
|
else:
|
|
else:
|