diff options
author | owsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2008-06-11 20:10:58 +0000 |
---|---|---|
committer | owsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2008-06-11 20:10:58 +0000 |
commit | 2f720810ab176f43217437c80c2f76b7d57dca96 (patch) | |
tree | 8278795a2ff7fa2d304fdfba0f046a29aa227402 /rdiff-backup | |
parent | 84bba327efa30d9d2dd992eeac175651349fbadb (diff) | |
download | rdiff-backup-2f720810ab176f43217437c80c2f76b7d57dca96.tar.gz |
Make rdiff-backup robust to failure to read the extended attributes or ACL
because the file cannot be found.
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@892 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup')
-rw-r--r-- | rdiff-backup/CHANGELOG | 4 | ||||
-rw-r--r-- | rdiff-backup/rdiff_backup/eas_acls.py | 27 |
2 files changed, 24 insertions, 7 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index cb60a5c..537eb0c 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,6 +1,10 @@ New in v1.1.16 (????/??/??) --------------------------- +Don't abort if can't read extended attributes or ACL because the path is +considered bad by the EA/ACL subsystem; print a warning instead. Problem +reported by Farkas Levente. (Andrew Ferguson) + rdiff-backup-statistics enhancements suggested by James Marsh: flush stdout before running other commands, and add a --quiet option to suppress printing the "Processing statistics from session..." lines. (Andrew Ferguson) diff --git a/rdiff-backup/rdiff_backup/eas_acls.py b/rdiff-backup/rdiff_backup/eas_acls.py index 5ea570b..a056dee 100644 --- a/rdiff-backup/rdiff_backup/eas_acls.py +++ b/rdiff-backup/rdiff_backup/eas_acls.py @@ -57,10 +57,10 @@ class ExtendedAttributes: def read_from_rp(self, rp): """Set the extended attributes from an rpath""" try: attr_list = rp.conn.xattr.listxattr(rp.path) - except IOError, exc: + except (IOError, ListError), exc: if exc[0] == errno.EOPNOTSUPP or exc[0] == errno.EPERM: return # if not supported, consider empty - if exc[0] == errno.EACCES: + if exc[0] == errno.EACCES or exc[0] == errno.ENOENT: log.Log("Warning: listattr(%s): %s" % (repr(rp.path), exc), 3) return raise @@ -93,9 +93,13 @@ class ExtendedAttributes: % (name, repr(rp.path)), 7) continue else: raise - except IOError, exc: + except (IOError, ListError), exc: if exc[0] == errno.EOPNOTSUPP or exc[0] == errno.EPERM: return # if not supported, consider empty + if exc[0] == errno.ENOENT: # path is bad + log.Log("Warning: unable to clear xattrs on %s: %s" % + (repr(rp.path), exc), 3) + return else: raise def write_to_rp(self, rp): @@ -104,10 +108,11 @@ class ExtendedAttributes: for (name, value) in self.attr_dict.iteritems(): try: rp.conn.xattr.setxattr(rp.path, name, value) - except IOError, exc: + except (IOError, ListError), exc: # Mac and Linux attributes have different namespaces, so # fail gracefully if can't call setxattr - if exc[0] == errno.EOPNOTSUPP or exc[0] == errno.EACCES: + if exc[0] == errno.EOPNOTSUPP or exc[0] == errno.EACCES \ + or exc[0] == errno.ENOENT: log.Log("Warning: unable to write xattr %s to %s" % (name, repr(rp.path)), 6) continue @@ -376,13 +381,21 @@ def get_acl_lists_from_rp(rp): """Returns (acl_list, def_acl_list) from an rpath. Call locally""" assert rp.conn is Globals.local_connection try: acl = posix1e.ACL(file=rp.path) - except IOError, exc: + except (IOError, ListError), exc: if exc[0] == errno.EOPNOTSUPP: acl = None + if exc[0] == errno.ENOENT: + log.Log("Warning: unable to read ACL from %s: %s" + % (repr(rp.path), exc), 3) + acl = None else: raise if rp.isdir(): try: def_acl = posix1e.ACL(filedef=rp.path) - except IOError, exc: + except (IOError, ListError), exc: if exc[0] == errno.EOPNOTSUPP: def_acl = None + if exc[0] == errno.ENOENT: + log.Log("Warning: unable to read default ACL from %s: %s" + % (repr(rp.path), exc), 3) + def_acl = None else: raise else: def_acl = None return (acl and acl_to_list(acl), def_acl and acl_to_list(def_acl)) |