Commit d1e1bb67 authored by owsla's avatar owsla

Support extended attributes on symbolic links


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@939 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 628622cb
New in v1.2.2 (????/??/??) New in v1.2.2 (????/??/??)
--------------------------- ---------------------------
Support extended attributes on symbolic links. (Andrew Ferguson)
On Mac OS X, read the com.apple.FinderInfo extended attribute since it is the On Mac OS X, read the com.apple.FinderInfo extended attribute since it is the
only storage location for the 'busy' (Z) Finder attribute. (Andrew Ferguson) only storage location for the 'busy' (Z) Finder attribute. (Andrew Ferguson)
......
...@@ -56,7 +56,7 @@ class ExtendedAttributes: ...@@ -56,7 +56,7 @@ class ExtendedAttributes:
def read_from_rp(self, rp): def read_from_rp(self, rp):
"""Set the extended attributes from an rpath""" """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: except IOError, exc:
if exc[0] in (errno.EOPNOTSUPP, errno.EPERM, errno.ETXTBSY): if exc[0] in (errno.EOPNOTSUPP, errno.EPERM, errno.ETXTBSY):
return # if not supported, consider empty return # if not supported, consider empty
...@@ -71,7 +71,7 @@ class ExtendedAttributes: ...@@ -71,7 +71,7 @@ class ExtendedAttributes:
if not rp.isdir() and attr == 'com.apple.ResourceFork': if not rp.isdir() and attr == 'com.apple.ResourceFork':
# Resource Fork handled elsewhere, except for directories # Resource Fork handled elsewhere, except for directories
continue 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: except IOError, exc:
# File probably modified while reading, just continue # File probably modified while reading, just continue
if exc[0] == errno.ENODATA: continue if exc[0] == errno.ENODATA: continue
...@@ -81,9 +81,9 @@ class ExtendedAttributes: ...@@ -81,9 +81,9 @@ 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"""
try: try:
for name in rp.conn.xattr.listxattr(rp.path): for name in rp.conn.xattr.listxattr(rp.path, rp.issym()):
try: try:
rp.conn.xattr.removexattr(rp.path, name) rp.conn.xattr.removexattr(rp.path, name, rp.issym())
except IOError, exc: except IOError, exc:
# SELinux attributes cannot be removed, and we don't want # SELinux attributes cannot be removed, and we don't want
# to bail out or be too noisy at low log levels. # to bail out or be too noisy at low log levels.
...@@ -106,7 +106,7 @@ class ExtendedAttributes: ...@@ -106,7 +106,7 @@ class ExtendedAttributes:
self.clear_rp(rp) self.clear_rp(rp)
for (name, value) in self.attr_dict.iteritems(): for (name, value) in self.attr_dict.iteritems():
try: try:
rp.conn.xattr.setxattr(rp.path, name, value) rp.conn.xattr.setxattr(rp.path, name, value, 0, rp.issym())
except IOError, exc: except IOError, exc:
# Mac and Linux attributes have different namespaces, so # Mac and Linux attributes have different namespaces, so
# fail gracefully if can't call setxattr # fail gracefully if can't call setxattr
...@@ -580,7 +580,7 @@ def rpath_ea_get(rp): ...@@ -580,7 +580,7 @@ def rpath_ea_get(rp):
""" """
ea = ExtendedAttributes(rp.index) 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) ea.read_from_rp(rp)
return ea return ea
rpath.ea_get = rpath_ea_get rpath.ea_get = rpath_ea_get
......
...@@ -174,8 +174,8 @@ def copy_attribs(rpin, rpout): ...@@ -174,8 +174,8 @@ def copy_attribs(rpin, rpout):
assert rpin.lstat() == rpout.lstat() or rpin.isspecial() assert rpin.lstat() == rpout.lstat() or rpin.isspecial()
if Globals.change_ownership: if Globals.change_ownership:
rpout.chown(*rpout.conn.user_group.map_rpath(rpin)) 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.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 if (Globals.resource_forks_write and rpin.isreg() and
rpin.has_resource_fork()): rpin.has_resource_fork()):
rpout.write_resource_fork(rpin.get_resource_fork()) rpout.write_resource_fork(rpin.get_resource_fork())
......
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