mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 06:31:58 +00:00
PR #235 - Merge branch 'fix_xattr' into merge
This commit is contained in:
commit
2f5e5e01ea
2 changed files with 9 additions and 4 deletions
|
@ -140,9 +140,14 @@ def create_test_files(self):
|
|||
os.path.join(self.input_path, 'hardlink'))
|
||||
# Symlink
|
||||
os.symlink('somewhere', os.path.join(self.input_path, 'link1'))
|
||||
if xattr.is_enabled():
|
||||
if xattr.is_enabled(self.input_path):
|
||||
xattr.setxattr(os.path.join(self.input_path, 'file1'), 'user.foo', b'bar')
|
||||
xattr.setxattr(os.path.join(self.input_path, 'link1'), 'user.foo_symlink', b'bar_symlink', follow_symlinks=False)
|
||||
# XXX this always fails for me
|
||||
# ubuntu 14.04, on a TMP dir filesystem with user_xattr, using fakeroot
|
||||
# same for newer ubuntu and centos.
|
||||
# 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.
|
||||
#xattr.setxattr(os.path.join(self.input_path, 'link1'), 'user.foo_symlink', b'bar_symlink', follow_symlinks=False)
|
||||
# FIFO node
|
||||
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
||||
if has_lchflags:
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
from ctypes.util import find_library
|
||||
|
||||
|
||||
def is_enabled():
|
||||
def is_enabled(path=None):
|
||||
"""Determine if xattr is enabled on the filesystem
|
||||
"""
|
||||
with tempfile.NamedTemporaryFile() as fd:
|
||||
with tempfile.NamedTemporaryFile(dir=path) as fd:
|
||||
try:
|
||||
setxattr(fd.fileno(), 'user.name', b'value')
|
||||
except OSError:
|
||||
|
|
Loading…
Reference in a new issue