Commit f9c01946 authored by owsla's avatar owsla

Handle exception when trying to clear extended attributes on a file that

doesn't support them.


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@827 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 14a68722
New in v1.1.13 (????/??/??) New in v1.1.13 (????/??/??)
--------------------------- ---------------------------
Don't throw an error when clearing extended attributes if they are not
supported on the file. (Andrew Ferguson)
New in v1.1.12 (2007/07/12) New in v1.1.12 (2007/07/12)
--------------------------- ---------------------------
......
...@@ -81,17 +81,22 @@ class ExtendedAttributes: ...@@ -81,17 +81,22 @@ class ExtendedAttributes:
def clear_rp(self, rp): def clear_rp(self, rp):
"""Delete all the extended attributes in rpath""" """Delete all the extended attributes in rpath"""
for name in rp.conn.xattr.listxattr(rp.path): try:
try: for name in rp.conn.xattr.listxattr(rp.path):
rp.conn.xattr.removexattr(rp.path, name) try:
except IOError, exc: rp.conn.xattr.removexattr(rp.path, name)
# SELinux attributes cannot be removed, and we don't want except IOError, exc:
# to bail out or be too noisy at low log levels. # SELinux attributes cannot be removed, and we don't want
if exc[0] == errno.EACCES: # to bail out or be too noisy at low log levels.
log.Log("Warning: unable to remove xattr %s from %s" if exc[0] == errno.EACCES:
% (name, rp.path), 7) log.Log("Warning: unable to remove xattr %s from %s"
continue % (name, rp.path), 7)
else: raise continue
else: raise
except IOError, exc:
if exc[0] == errno.EOPNOTSUPP or exc[0] == errno.EPERM:
return # if not supported, consider empty
else: raise
def write_to_rp(self, rp): def write_to_rp(self, rp):
"""Write extended attributes to rpath rp""" """Write extended attributes to rpath rp"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment