From 3a387f741bb536bbe55e766cc94c6043047e1730 Mon Sep 17 00:00:00 2001 From: owsla Date: Sat, 27 Sep 2008 00:08:31 +0000 Subject: Support extended attributes on symbolic links git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@939 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/rdiff_backup/eas_acls.py | 12 ++++++------ rdiff-backup/rdiff_backup/rpath.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'rdiff-backup/rdiff_backup') diff --git a/rdiff-backup/rdiff_backup/eas_acls.py b/rdiff-backup/rdiff_backup/eas_acls.py index af01c5e..82b0190 100644 --- a/rdiff-backup/rdiff_backup/eas_acls.py +++ b/rdiff-backup/rdiff_backup/eas_acls.py @@ -56,7 +56,7 @@ class ExtendedAttributes: def read_from_rp(self, rp): """Set the extended attributes from an rpath""" - try: attr_list = rp.conn.xattr.listxattr(rp.path) + try: attr_list = rp.conn.xattr.listxattr(rp.path, rp.issym()) except IOError, exc: if exc[0] in (errno.EOPNOTSUPP, errno.EPERM, errno.ETXTBSY): return # if not supported, consider empty @@ -71,7 +71,7 @@ class ExtendedAttributes: if not rp.isdir() and attr == 'com.apple.ResourceFork': # Resource Fork handled elsewhere, except for directories continue - try: self.attr_dict[attr] = rp.conn.xattr.getxattr(rp.path, attr) + try: self.attr_dict[attr] = rp.conn.xattr.getxattr(rp.path, attr, rp.issym()) except IOError, exc: # File probably modified while reading, just continue if exc[0] == errno.ENODATA: continue @@ -81,9 +81,9 @@ class ExtendedAttributes: def clear_rp(self, rp): """Delete all the extended attributes in rpath""" try: - for name in rp.conn.xattr.listxattr(rp.path): + for name in rp.conn.xattr.listxattr(rp.path, rp.issym()): try: - rp.conn.xattr.removexattr(rp.path, name) + rp.conn.xattr.removexattr(rp.path, name, rp.issym()) except IOError, exc: # SELinux attributes cannot be removed, and we don't want # to bail out or be too noisy at low log levels. @@ -106,7 +106,7 @@ class ExtendedAttributes: self.clear_rp(rp) for (name, value) in self.attr_dict.iteritems(): try: - rp.conn.xattr.setxattr(rp.path, name, value) + rp.conn.xattr.setxattr(rp.path, name, value, 0, rp.issym()) except IOError, exc: # Mac and Linux attributes have different namespaces, so # fail gracefully if can't call setxattr @@ -580,7 +580,7 @@ def rpath_ea_get(rp): """ ea = ExtendedAttributes(rp.index) - if not rp.issym() and not rp.issock() and not rp.isfifo(): + if not rp.issock() and not rp.isfifo(): ea.read_from_rp(rp) return ea rpath.ea_get = rpath_ea_get diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py index 8fd7d85..041fd9d 100644 --- a/rdiff-backup/rdiff_backup/rpath.py +++ b/rdiff-backup/rdiff_backup/rpath.py @@ -174,8 +174,8 @@ def copy_attribs(rpin, rpout): assert rpin.lstat() == rpout.lstat() or rpin.isspecial() 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 rpin.issym(): return # symlinks don't have times or perms if (Globals.resource_forks_write and rpin.isreg() and rpin.has_resource_fork()): rpout.write_resource_fork(rpin.get_resource_fork()) -- cgit v1.2.1