summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordgaudet <dgaudet@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2006-11-05 01:30:02 +0000
committerdgaudet <dgaudet@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2006-11-05 01:30:02 +0000
commitfece2fa190a8af5201353e06c59f8566b1bb5454 (patch)
tree2fcfb11227bf80b3756ea6acaaebebaf173b8830
parentf7dc50b215eb22a7b50b17687f92b20f7d629f41 (diff)
downloadrdiff-backup-fece2fa190a8af5201353e06c59f8566b1bb5454.tar.gz
Mac OS X Extended Attributes support. (Patch from Andrew Ferguson.)
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@760 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG2
-rw-r--r--rdiff-backup/rdiff_backup/eas_acls.py16
-rw-r--r--rdiff-backup/rdiff_backup/rpath.py4
3 files changed, 17 insertions, 5 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index bda8df0..d176a70 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -1,6 +1,8 @@
New in v1.1.6 (????/??/??)
--------------------------
+Mac OS X Extended Attributes support. (Patch from Andrew Ferguson.)
+
Preserve Mac OS X 'Creation Date' field across backups. (Patch from Andrew
Ferguson.)
diff --git a/rdiff-backup/rdiff_backup/eas_acls.py b/rdiff-backup/rdiff_backup/eas_acls.py
index e346a19..9b1f887 100644
--- a/rdiff-backup/rdiff_backup/eas_acls.py
+++ b/rdiff-backup/rdiff_backup/eas_acls.py
@@ -64,8 +64,11 @@ class ExtendedAttributes:
return
raise
for attr in attr_list:
- if not attr.startswith('user.'):
- # Only preserve user extended attributes
+ if attr.startswith('system.'):
+ # Do not preserve system extended attributes
+ continue
+ if attr == 'com.apple.FinderInfo' or attr == 'come.apple.ResourceFork':
+ # FinderInfo and Resource Fork handled elsewhere
continue
try: self.attr_dict[attr] = rp.conn.xattr.getxattr(rp.path, attr)
except IOError, exc:
@@ -92,7 +95,14 @@ class ExtendedAttributes:
"""Write extended attributes to rpath rp"""
self.clear_rp(rp)
for (name, value) in self.attr_dict.iteritems():
- rp.conn.xattr.setxattr(rp.path, name, value)
+ try:
+ rp.conn.xattr.setxattr(rp.path, name, value)
+ except IOError, 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:
+ continue
+ else: raise
def get(self, name):
"""Return attribute attached to given name"""
diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py
index 6e77e24..4f5cbb9 100644
--- a/rdiff-backup/rdiff_backup/rpath.py
+++ b/rdiff-backup/rdiff_backup/rpath.py
@@ -165,13 +165,13 @@ def copy_attribs(rpin, rpout):
if Globals.change_ownership:
rpout.chown(*rpout.conn.user_group.map_rpath(rpin))
if rpin.issym(): return # symlinks don't have times or perms
+ if Globals.eas_write: rpout.write_ea(rpin.get_ea())
if (Globals.resource_forks_write and rpin.isreg() and
rpin.has_resource_fork()):
rpout.write_resource_fork(rpin.get_resource_fork())
if (Globals.carbonfile_write and rpin.isreg() and
rpin.has_carbonfile()):
rpout.write_carbonfile(rpin.get_carbonfile())
- if Globals.eas_write: rpout.write_ea(rpin.get_ea())
rpout.chmod(rpin.getperms())
if Globals.acls_write: rpout.write_acl(rpin.get_acl())
if not rpin.isdev(): rpout.setmtime(rpin.getmtime())
@@ -188,13 +188,13 @@ def copy_attribs_inc(rpin, rpout):
check_for_files(rpin, rpout)
if Globals.change_ownership: apply(rpout.chown, rpin.getuidgid())
if rpin.issym(): return # symlinks don't have times or perms
+ if Globals.eas_write: rpout.write_ea(rpin.get_ea())
if (Globals.resource_forks_write and rpin.isreg() and
rpin.has_resource_fork() and rpout.isreg()):
rpout.write_resource_fork(rpin.get_resource_fork())
if (Globals.carbonfile_write and rpin.isreg() and
rpin.has_carbonfile() and rpout.isreg()):
rpout.write_carbonfile(rpin.get_carbonfile())
- if Globals.eas_write: rpout.write_ea(rpin.get_ea())
if rpin.isdir() and not rpout.isdir():
rpout.chmod(rpin.getperms() & 0777)
else: rpout.chmod(rpin.getperms())