1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-22 22:22:27 +00:00

give specific path to xattr.is_enabled(), disable symlink setattr call that always fails

This commit is contained in:
Thomas Waldmann 2015-03-15 00:20:50 +01:00
parent 4ab4ecc7af
commit 6116fa72b2
2 changed files with 9 additions and 4 deletions

View file

@ -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:

View file

@ -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: