From 6116fa72b2d06b7ba5b2ede5fec6fd311f992e7d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 15 Mar 2015 00:20:50 +0100 Subject: [PATCH] give specific path to xattr.is_enabled(), disable symlink setattr call that always fails --- attic/testsuite/archiver.py | 9 +++++++-- attic/xattr.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/attic/testsuite/archiver.py b/attic/testsuite/archiver.py index 382fcc854..543551a51 100644 --- a/attic/testsuite/archiver.py +++ b/attic/testsuite/archiver.py @@ -140,9 +140,14 @@ class ArchiverTestCase(ArchiverTestCaseBase): 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: diff --git a/attic/xattr.py b/attic/xattr.py index e00610155..07bc2a6b9 100644 --- a/attic/xattr.py +++ b/attic/xattr.py @@ -8,10 +8,10 @@ from ctypes import CDLL, create_string_buffer, c_ssize_t, c_size_t, c_char_p, c_ 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: