Bläddra i källkod

PR #235 - Merge branch 'fix_xattr' into merge

Thomas Waldmann 10 år sedan
förälder
incheckning
2f5e5e01ea
2 ändrade filer med 9 tillägg och 4 borttagningar
  1. 7 2
      attic/testsuite/archiver.py
  2. 2 2
      attic/xattr.py

+ 7 - 2
attic/testsuite/archiver.py

@@ -140,9 +140,14 @@ class ArchiverTestCase(ArchiverTestCaseBase):
                 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:

+ 2 - 2
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
 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: