mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 14:41:43 +00:00
give specific path to xattr.is_enabled(), disable symlink setattr call that always fails
This commit is contained in:
parent
4ab4ecc7af
commit
6116fa72b2
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'))
|
os.path.join(self.input_path, 'hardlink'))
|
||||||
# Symlink
|
# Symlink
|
||||||
os.symlink('somewhere', os.path.join(self.input_path, 'link1'))
|
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, '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
|
# FIFO node
|
||||||
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
||||||
if has_lchflags:
|
if has_lchflags:
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
from ctypes.util import find_library
|
from ctypes.util import find_library
|
||||||
|
|
||||||
|
|
||||||
def is_enabled():
|
def is_enabled(path=None):
|
||||||
"""Determine if xattr is enabled on the filesystem
|
"""Determine if xattr is enabled on the filesystem
|
||||||
"""
|
"""
|
||||||
with tempfile.NamedTemporaryFile() as fd:
|
with tempfile.NamedTemporaryFile(dir=path) as fd:
|
||||||
try:
|
try:
|
||||||
setxattr(fd.fileno(), 'user.name', b'value')
|
setxattr(fd.fileno(), 'user.name', b'value')
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
Loading…
Reference in a new issue