_copyxattr: handle EOPNOTSUPP from xattr.list()
authorZac Medico <zmedico@gentoo.org>
Tue, 3 Sep 2013 20:03:17 +0000 (13:03 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 3 Sep 2013 20:03:17 +0000 (13:03 -0700)
pym/portage/util/movefile.py

index 4ac4535136aaf580497abd09d6dee61f1e3edfc7..1f92b59b7251ec3416f1c3febb1563fddf21821b 100644 (file)
@@ -98,7 +98,19 @@ else:
        if xattr is not None:
                def _copyxattr(src, dest, exclude=None):
 
-                       attrs = xattr.list(src)
+                       try:
+                               attrs = xattr.list(src)
+                               raise_exception = False
+                       except IOError as e:
+                               raise_exception = True
+                               if e.errno != OperationNotSupported.errno:
+                                       raise
+                       if raise_exception:
+                               raise OperationNotSupported(
+                                       _("Filesystem containing file '%s' "
+                                       "does not support listing of extended attributes") %
+                                       (_unicode_decode(src),))
+
                        if attrs:
                                if exclude is not None and isinstance(attrs[0], bytes):
                                        exclude = exclude.encode(_encodings['fs'])