1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 17:57:59 +00:00

xattr key names must start with user. on linux

... or the call will just error with "operation not supported"

(cherry picked from commit 53971e8e79)
This commit is contained in:
Thomas Waldmann 2018-11-14 01:10:16 +01:00
parent 95aa1e77fd
commit 60347a4dd6

View file

@ -1256,14 +1256,14 @@ def patched_setxattr_EACCES(*args, **kwargs):
raise OSError(errno.EACCES, 'EACCES')
self.create_regular_file('file')
xattr.setxattr('input/file', 'attribute', 'value')
xattr.setxattr('input/file', 'user.attribute', 'value')
self.cmd('init', self.repository_location, '-e' 'none')
self.cmd('create', self.repository_location + '::test', 'input')
with changedir('output'):
input_abspath = os.path.abspath('input/file')
with patch.object(xattr, 'setxattr', patched_setxattr_E2BIG):
out = self.cmd('extract', self.repository_location + '::test', exit_code=EXIT_WARNING)
assert out == (input_abspath + ': Value or key of extended attribute attribute is too big for this '
assert out == (input_abspath + ': Value or key of extended attribute user.attribute is too big for this '
'filesystem\n')
os.remove(input_abspath)
with patch.object(xattr, 'setxattr', patched_setxattr_ENOTSUP):
@ -1272,7 +1272,7 @@ def patched_setxattr_EACCES(*args, **kwargs):
os.remove(input_abspath)
with patch.object(xattr, 'setxattr', patched_setxattr_EACCES):
out = self.cmd('extract', self.repository_location + '::test', exit_code=EXIT_WARNING)
assert out == (input_abspath + ': Permission denied when setting extended attribute attribute\n')
assert out == (input_abspath + ': Permission denied when setting extended attribute user.attribute\n')
assert os.path.isfile(input_abspath)
def test_path_normalization(self):