From 7815ed5885ce232e68452b04a3c252836b3cada9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Borgstr=C3=B6m?= Date: Mon, 5 Aug 2013 20:38:37 +0200 Subject: [PATCH] Fix xattr issue on OS X. --- attic/testsuite/archiver.py | 2 +- attic/xattr.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/attic/testsuite/archiver.py b/attic/testsuite/archiver.py index ec3d5857c..876cb1d6a 100644 --- a/attic/testsuite/archiver.py +++ b/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] fd = open(os.path.join(self.tmpdir, 'repository', 'data', '0', name), 'r+') fd.seek(100) - fd.write('X') + fd.write('XXXX') fd.close() self.attic('verify', self.repository_location + '::test', exit_code=1) diff --git a/attic/xattr.py b/attic/xattr.py index df49b46a8..e3e2d9aeb 100644 --- a/attic/xattr.py +++ b/attic/xattr.py @@ -124,7 +124,12 @@ except ImportError: func = libc.flistxattr elif not follow_symlinks: 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: return [] namebuf = create_string_buffer(n)