On Sat, 2008-01-26 at 15:52 -0500, Matt McCutchen wrote: > Rsync is > unlikely to be able to manipulate xattrs on 10.3 unless we can figure > out what the old API is and add it as another case in > lib/sysxattrs.{c,h} .
I poked around some more. Here is my current understanding of the xattr situation: - All versions of Mac OS X support certain Mac-specific attributes, including resource fork, finder flags, and creation time. The getattrlist and setattrlist functions access most of these: http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/getattrlist.2.html http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/setattrlist.2.html - Mac OS 10.4+ supports arbitrarily named xattrs through the getxattr interface. Its implementation of this interface also exposes most of the Mac-specific attributes as xattrs with specific names, allowing rsync to preserve them as it would any other xattr. - Oddly, the creation time is not exposed at the 10.4+ getxattr level. Thus, osx-create-time.diff adds a special case at rsync's getxattr abstraction level to expose the creation time (accessed via {get,set}attrlist) as an xattr named "com.apple.crtime96". This name is rsync-specific and was chosen by Wayne. It will be stored on non-Mac filesystems to which Mac files have been copied, so we have to be careful about changing it later. - 10.3 does not support arbitrarily named xattrs and does not provide the getxattr interface. To make rsync preserve the Mac-specific attributes, we would need to write code to access each one individually using {get,set}attrlist, like osx-create-time.diff does for creation times. Probably the most natural approach is to wire these up to rsync's getxattr abstraction level using the same names by which they are exposed by 10.4+. This way, rsync copies between 10.3 and 10.4 will just work. The operation of the current rsync getxattr abstraction layer to read an xattr named N can be described as follows (the top three lines coming from osx-create-time.diff): if (mac && N == "com.apple.crtime96") getattrlist(ATTR_CMN_CRTIME); else getxattr(N); To fully support Mac OS 10.3 attributes, we will need an extra configure test to distinguish 10.3 from 10.4+ and an abstraction layer like this: if (mac && N == "com.apple.crtime96") getattrlist(ATTR_CMN_CRTIME); else if (mac < 10.4) { if (N == "com.apple.FinderInfo") getattrlist(ATTR_CMN_FNDRINFO); else if (N == "com.apple.ResourceFork") // I'm not sure of the API to access the resource fork. // More cases here? else // No other xattrs exist. } else getxattr(N); See also the following message by Wesley Terpstra for some related ideas, including how attributes might interact with --fake-super: http://lists.samba.org/archive/rsync/2007-October/018892.html Please correct me if any of the above is wrong. And...does anyone who has a Mac feel like implementing this? Matt -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html