Making rsync compile under Mac OS X 10.3.9 with extended attributes

Matt McCutchen matt at
Sat Jan 26 21:43:01 GMT 2008

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

- 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:

- 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 "".  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 == "")

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 == "")
else if (mac < 10.4) {
	if (N == "")
	else if (N == "")
		// I'm not sure of the API to access the resource fork.
	// More cases here?
		// No other xattrs exist.
} else

See also the following message by Wesley Terpstra for some related
ideas, including how attributes might interact with --fake-super:

Please correct me if any of the above is wrong.  And...does anyone who
has a Mac feel like implementing this?


More information about the rsync mailing list