Commit 8169f6d3 authored by dgaudet's avatar dgaudet

Mac OS X Extended Attributes support. (Patch from Andrew Ferguson.)


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@760 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 73744ae5
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.)
......
......@@ -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():
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"""
......
......@@ -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())
......
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