mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 14:41:43 +00:00
xattrs: linux does not allow user.* xattrs on symlinks
This commit is contained in:
parent
53971e8e79
commit
3d05a4b114
1 changed files with 8 additions and 3 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
from ..platform.xattr import buffer, split_lstring
|
||||
from ..xattr import is_enabled, getxattr, setxattr, listxattr
|
||||
from ..platformflags import is_linux
|
||||
from . import BaseTestCase
|
||||
|
||||
|
||||
|
@ -36,15 +37,19 @@ def test(self):
|
|||
setxattr(tmp_fn, b'user.foo', b'bar')
|
||||
setxattr(tmp_fd, b'user.bar', b'foo')
|
||||
setxattr(tmp_fn, b'user.empty', b'')
|
||||
setxattr(tmp_lfn, b'user.linkxattr', b'baz')
|
||||
if not is_linux:
|
||||
# linux does not allow setting user.* xattrs on symlinks
|
||||
setxattr(tmp_lfn, b'user.linkxattr', b'baz')
|
||||
self.assert_equal_se(listxattr(tmp_fn), [b'user.foo', b'user.bar', b'user.empty'])
|
||||
self.assert_equal_se(listxattr(tmp_fd), [b'user.foo', b'user.bar', b'user.empty'])
|
||||
self.assert_equal_se(listxattr(tmp_lfn, follow_symlinks=True), [b'user.foo', b'user.bar', b'user.empty'])
|
||||
self.assert_equal_se(listxattr(tmp_lfn), [b'user.linkxattr'])
|
||||
if not is_linux:
|
||||
self.assert_equal_se(listxattr(tmp_lfn), [b'user.linkxattr'])
|
||||
self.assert_equal(getxattr(tmp_fn, b'user.foo'), b'bar')
|
||||
self.assert_equal(getxattr(tmp_fd, b'user.foo'), b'bar')
|
||||
self.assert_equal(getxattr(tmp_lfn, b'user.foo', follow_symlinks=True), b'bar')
|
||||
self.assert_equal(getxattr(tmp_lfn, b'user.linkxattr'), b'baz')
|
||||
if not is_linux:
|
||||
self.assert_equal(getxattr(tmp_lfn, b'user.linkxattr'), b'baz')
|
||||
self.assert_equal(getxattr(tmp_fn, b'user.empty'), b'')
|
||||
|
||||
def test_listxattr_buffer_growth(self):
|
||||
|
|
Loading…
Reference in a new issue