Browse Source

Ignore xattr errors during extract if not supported by the filesystem

Closes #46.
Jonas Borgström 11 years ago
parent
commit
88ff981eee
2 changed files with 8 additions and 3 deletions
  1. 1 0
      CHANGES
  2. 7 3
      attic/archive.py

+ 1 - 0
CHANGES

@@ -16,6 +16,7 @@ Version 0.11
 - "attic verify" has been deprecated. Use "attic extract --dry-run" instead.
 - "attic prune --hourly|daily|..." has been deprecated.
   Use "attic prune --keep-hourly|daily|..." instead.
+- Ignore xattr errors during "extract" if not supported by the filesystem. (#46)
 
 Version 0.10
 ------------

+ 7 - 3
attic/archive.py

@@ -1,7 +1,7 @@
-from binascii import hexlify
 from datetime import datetime, timedelta, timezone
 from getpass import getuser
 from itertools import groupby
+import errno
 import shutil
 import tempfile
 from attic.key import key_factory
@@ -283,8 +283,12 @@ class Archive:
     def restore_attrs(self, path, item, symlink=False, fd=None):
         xattrs = item.get(b'xattrs')
         if xattrs:
-            for k, v in xattrs.items():
-                xattr.setxattr(fd or path, k, v)
+                for k, v in xattrs.items():
+                    try:
+                        xattr.setxattr(fd or path, k, v)
+                    except OSError as e:
+                        if e.errno != errno.ENOTSUP:
+                            raise
         uid = gid = None
         if not self.numeric_owner:
             uid = user2uid(item[b'user'])