Explorar el Código

Fix xattr issue on OS X.

Jonas Borgström hace 12 años
padre
commit
7815ed5885
Se han modificado 2 ficheros con 7 adiciones y 2 borrados
  1. 1 1
      attic/testsuite/archiver.py
  2. 6 1
      attic/xattr.py

+ 1 - 1
attic/testsuite/archiver.py

@@ -206,7 +206,7 @@ class ArchiverTestCase(AtticTestCase):
         name = sorted(os.listdir(os.path.join(self.tmpdir, 'repository', 'data', '0')), reverse=True)[0]
         name = sorted(os.listdir(os.path.join(self.tmpdir, 'repository', 'data', '0')), reverse=True)[0]
         fd = open(os.path.join(self.tmpdir, 'repository', 'data', '0', name), 'r+')
         fd = open(os.path.join(self.tmpdir, 'repository', 'data', '0', name), 'r+')
         fd.seek(100)
         fd.seek(100)
-        fd.write('X')
+        fd.write('XXXX')
         fd.close()
         fd.close()
         self.attic('verify', self.repository_location + '::test', exit_code=1)
         self.attic('verify', self.repository_location + '::test', exit_code=1)
 
 

+ 6 - 1
attic/xattr.py

@@ -124,7 +124,12 @@ except ImportError:
                 func = libc.flistxattr
                 func = libc.flistxattr
             elif not follow_symlinks:
             elif not follow_symlinks:
                 flags = XATTR_NOFOLLOW
                 flags = XATTR_NOFOLLOW
-            n = _check(func(path, None, 0, flags), path)
+            try:
+                n = _check(func(path, None, 0, flags), path)
+            except OSError as e:
+                if e.errno == errno.EPERM:
+                    return []
+                raise
             if n == 0:
             if n == 0:
                 return []
                 return []
             namebuf = create_string_buffer(n)
             namebuf = create_string_buffer(n)