Adding extended attributes support to rsync

The rsync software that comes with Mac OS X 10.4, and newer releases, supports extended attributes (HFS+ resource forks). This means it can sync files from a local HFS+ filesystem to a remote volume which does not suport HFS+ resource forks by using AppleDouble encoding.

The AppleDouble encoding splits a native HFS+ file in two parts:

  1. The data fork, which is the one that holds the real contents of the file, like the contents of a document, the pixels from a bitmap, and so on. It receives the same name as the original HFS+ file.
  2. The resource fork, which is built of data held on the resource forks and Finder data, like the Spotlight comments and so on. It receives a filename which consists on prepending a dot and a slash characters to the original HFS+ filename.

Thus, for a HFS+ file named MyDocument.webloc, when stored in the AppleDouble format, it is splitted in two files: MyDocument.webloc and ._MyDocument.webloc.

By default, Mac OS X rsync implementation does not enable extended attributes support. This must be explicitly enabled by supplying the -E command-line switch to the rsync command. The problem is, however, that few rsync implementations (I don’t know of any besides Apple’s Mac OS X 10.4 one) support neither this kind of functionality nor the command-line switch that activates it.

The solution was pretty easy, by the way. I downloaded Darwin rsync source code for the rsync-20 from the Darwin Projects Directory and extracted the file patches/EA.diff from within it. This patch file includes the extended attributes (HFS+ resource forks) functionality I was seeking. This patch, at the moment of this writing, is agaist rsync-2.6.3.

Thus, I only had to grab the sources for rsync-2.6.3, which are also included inside the rsync-20.tar.gz file I downloaded before, extracted them, patched, configured, made and installed:

# tar zxvf rsync-20.tar.gz # cd rsync-20 # tar zxvf rsync-2.6.3.tar.gz # cd rsync-2.6.3 # patch < ../patches/EA.diff # CFLAGS="-O -pipe" ./configure --prefix=/usr/local --disable-debug --enable-ea-support --with-rsyncd-conf=/usr/local/etc/rsyncd.conf # make # make install

I ran the previous commands on FreeBSD 7.0-CURRENT, thus the /usr/local prefix. Also, note the –enable-ea-support command-line switch supplied to configure. It is required in order to build the extended attributes support in. Leaving it out will produce a normal, EA-disabled rsync.

# rsync --help | grep -- -E
 -E, --extended-attributes   copy extended attributes

That’s all, folks. 🙂


2 thoughts on “Adding extended attributes support to rsync

  1. Very good blog you have here but I was wondering if you knew of any message boards that cover the same topics talked about here? I’d really like to be a part of online community where I can get responses from other knowledgeable people that share the same interest. If you have any suggestions, please let me know. Many thanks!

  2. hello everyone I see all of u guys are interested in hacking well first let me tell u this, hacking isn’t easy u have to dedicated and have the will to learn for those of u who want to hack websites these programs aren’t the answer you have to learn to programme fir example learn HTML,php,JavaScript,mysql and u will find out how to hack into websites on ur own, for compute hacking learn C and C++ these are languages used to prgramme computer learn Linux and keep learning you’ll get there

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s