mirror of https://github.com/borgbackup/borg.git
xattrs: linux does not allow user.* xattrs on symlinks
This commit is contained in:
parent
53971e8e79
commit
3d05a4b114
|
@ -6,6 +6,7 @@ import pytest
|
||||||
|
|
||||||
from ..platform.xattr import buffer, split_lstring
|
from ..platform.xattr import buffer, split_lstring
|
||||||
from ..xattr import is_enabled, getxattr, setxattr, listxattr
|
from ..xattr import is_enabled, getxattr, setxattr, listxattr
|
||||||
|
from ..platformflags import is_linux
|
||||||
from . import BaseTestCase
|
from . import BaseTestCase
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,15 +37,19 @@ class XattrTestCase(BaseTestCase):
|
||||||
setxattr(tmp_fn, b'user.foo', b'bar')
|
setxattr(tmp_fn, b'user.foo', b'bar')
|
||||||
setxattr(tmp_fd, b'user.bar', b'foo')
|
setxattr(tmp_fd, b'user.bar', b'foo')
|
||||||
setxattr(tmp_fn, b'user.empty', b'')
|
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_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_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, 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_fn, b'user.foo'), b'bar')
|
||||||
self.assert_equal(getxattr(tmp_fd, 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.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'')
|
self.assert_equal(getxattr(tmp_fn, b'user.empty'), b'')
|
||||||
|
|
||||||
def test_listxattr_buffer_growth(self):
|
def test_listxattr_buffer_growth(self):
|
||||||
|
|
Loading…
Reference in New Issue