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 (????/??/??)
---------------------------
Support extended attributes on symbolic links. (Andrew Ferguson)
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)
......
......@@ -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
......
......@@ -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())
......
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