Monday, June 15, 2009

Latest version of rsync

I started with these directions to compile rsync, but updated to the latest version, 3.0.6, with my own variants to log every step noted in red.

Compile rsync 3.0.6

Follow these instructions in Terminal on both the client and server to download and compile rsync 3.0.6:

Download and unarchive rsync and its patches

cd ~/Desktop

curl -O http://rsync.samba.org/ftp/rsync/rsync-3.0.6.tar.gz

tar -xzvf rsync-3.0.6.tar.gz

rm rsync-3.0.6.tar.gz

curl -O http://rsync.samba.org/ftp/rsync/rsync-patches-3.0.6.tar.gz

tar -xzvf rsync-patches-3.0.6.tar.gz

rm rsync-patches-3.0.6.tar.gz

cd rsync-3.0.6

Apply patches relevant to preserving Mac OS X metadata

patch -p1 <patches/fileflags.diff

patch -p1 <patches/crtimes.diff

Configure, make, install

./prepare-source 2>&1 | tee prepare-source.out

./configure 2>&1 | tee configure.out

make 2>&1 | tee make.out

sudo make install 2>&1 | tee make-install.out

Verify your installation

[hope:~] /usr/local/bin/rsync --version

rsync version 3.0.6 protocol version 30

Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.

Web site: http://rsync.samba.org/

Capabilities:

64-bit files, 32-bit inums, 32-bit timestamps, 64-bit long ints,

socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,

append, ACLs, xattrs, iconv, symtimes, file-flags

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you

are welcome to redistribute it under certain conditions. See the GNU

General Public Licence for details.

By default, rsync will be installed in /usr/local/bin. If that isn't in your path, you will need to call your new version of rsync by its absolute path (/usr/local/bin/rsync).

So let's compare ... 3.0.5 with no symtimes to 3.0.6 with symtimes. And bugfixes of course. But still Protocol 30, and no significant changes since those directions.

Hmm. Well, I could mull this over with no way of knowing for sure, or I could re-run the unit tests in Backup Bouncer against this fresh compile!

sudo /usr/local/bin/rsync -aNHAX --fileflags --force-change --delete --stats /Volumes/Src/ /Volumes/Dst

sudo ./bbouncer verify -d /Volumes/Src /Volumes/Dst

Verifying: basic-permissions ... ok (Critical)

Verifying: timestamps ... ok (Critical)

Verifying: symlinks ... ok (Critical)

Verifying: symlink-ownership ... ok

Verifying: hardlinks ... ok (Important)

Verifying: resource-forks ...

Sub-test: on files ... ok (Critical)

Sub-test: on hardlinked files ... ok (Important)

Verifying: finder-flags ... ok (Critical)

Verifying: finder-locks ... ok

Verifying: creation-date ... ok

Verifying: bsd-flags ... ok

Verifying: extended-attrs ...

Sub-test: on files ... ok (Important)

Sub-test: on directories ... ok (Important)

Sub-test: on symlinks ... ok

Verifying: access-control-lists ...

Sub-test: on files ... ok (Important)

Sub-test: on dirs ... ok (Important)

Verifying: fifo ... ok

Verifying: devices ... ok

Verifying: combo-tests ...

Sub-test: xattrs + rsrc forks ... ok

Sub-test: lots of metadata ... ok

OK, that's pretty awesome! A complete pass! Now I wonder how much of that is because he knew what flags to use with rsync. So, out with the lart (the last MacPorts test in /opt/local/bin), in with the new.

sudo port -f uninstall rsync

sudo port -f install rsync

/opt/local/bin/rsync --version

rsync version 3.0.5 protocol version 30

Copyright (C) 1996-2008 by Andrew Tridgell, Wayne Davison, and others.

Web site: http://rsync.samba.org/

Capabilities:

64-bit files, 32-bit inums, 32-bit timestamps, 64-bit long ints,

socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,

append, ACLs, xattrs, iconv, symtimes, file-flags

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you

are welcome to redistribute it under certain conditions. See the GNU

General Public Licence for details.

All the same capabilities as what I just compiled. Re-test!

sudo ./bbouncer clean /Volumes/Dst

sudo /opt/local/bin/rsync -aNHAX --fileflags --force-change --delete --stats /Volumes/Src/ /Volumes/Dst

sudo ./bbouncer verify -d /Volumes/Src /Volumes/Dst

Verifying: basic-permissions ... ok (Critical)

Verifying: timestamps ... ok (Critical)

Verifying: symlinks ... ok (Critical)

Verifying: symlink-ownership ... ok

Verifying: hardlinks ... ok (Important)

Verifying: resource-forks ...

Sub-test: on files ... ok (Critical)

Sub-test: on hardlinked files ... ok (Important)

Verifying: finder-flags ... ok (Critical)

Verifying: finder-locks ... ok

Verifying: creation-date ... ok

Verifying: bsd-flags ... ok

Verifying: extended-attrs ...

Sub-test: on files ... ok (Important)

Sub-test: on directories ... ok (Important)

Sub-test: on symlinks ... ok

Verifying: access-control-lists ...

Sub-test: on files ... ok (Important)

Sub-test: on dirs ... ok (Important)

Verifying: fifo ... ok

Verifying: devices ... ok

Verifying: combo-tests ...

Sub-test: xattrs + rsrc forks ... ok

Sub-test: lots of metadata ... ok

Well, whaddaya know ... it's not the new version so much as know what flags to send to rsync. So how does Apple fare with those flags?

sudo /usr/bin/rsync -aNHAX --fileflags --force-change --delete --stats /Volumes/Src/ /Volumes/Dst

rsync: -aNHAX: unknown option

rsync error: syntax or usage error (code 1) at /SourceCache/rsync/rsync-35.2/rsync/main.c(1333) [client=2.6.9]

/usr/bin/rsync --help 2>&1 | grep -- "-a\|-N\|-H\|-A\|-X"

-a, --archive archive mode; same as -rlptgoD (no -H)

--append append data onto shorter files

-H, --hard-links preserve hard links

--delete-after receiver deletes after transfer, not before

--address=ADDRESS bind address for outgoing socket to daemon

-E, --extended-attributes copy extended attributes

OK, so I'll whittle that down to what Apple's rsync will accept, swapping the X for an E (depending on version as to which flag means extended attributes).

sudo /usr/bin/rsync -aHE --delete --stats /Volumes/Src/ /Volumes/Dst

copyfile(70-extended-attrs/.._symlink-with-xattrs.4GgbUd,70-extended-attrs/symlink-with-xattrs, COPYFILE_UNPACK) failed:62

rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-35.2/rsync/main.c(992) [sender=2.6.9]

sudo ./bbouncer verify -d /Volumes/Src /Volumes/Dst

Verifying: basic-permissions ... ok (Critical)

Verifying: timestamps ... ok (Critical)

Verifying: symlinks ... ok (Critical)

Verifying: symlink-ownership ... ok

Verifying: hardlinks ... ok (Important)

Verifying: resource-forks ...

Sub-test: on files ... ok (Critical)

Sub-test: on hardlinked files ... FAIL (Important)

Verifying: finder-flags ... ok (Critical)

Verifying: finder-locks ... FAIL

Verifying: creation-date ... FAIL

Verifying: bsd-flags ... ok

Verifying: extended-attrs ...

Sub-test: on files ... ok (Important)

Sub-test: on directories ... ok (Important)

Sub-test: on symlinks ... FAIL

Verifying: access-control-lists ...

Sub-test: on files ... ok (Important)

Sub-test: on dirs ... ok (Important)

Verifying: fifo ... ok

Verifying: devices ... ok

Verifying: combo-tests ...

Sub-test: xattrs + rsrc forks ... ok

Sub-test: lots of metadata ... FAIL

However, since -a and -H are incompatible according to --help and hardlinks failed, let's try again.

sudo ./bbouncer clean /Volumes/Dst

sudo /usr/bin/rsync -HEr --delete --stats /Volumes/Src/ /Volumes/Dst

skipping non-regular file "10-symlinks/broken_symlink"

skipping non-regular file "10-symlinks/link2broken_symlink"

skipping non-regular file "10-symlinks/symlink1"

skipping non-regular file "10-symlinks/symlink2"

skipping non-regular file "10-symlinks/symlink3"

skipping non-regular file "15-symlink-ownership/symlink1"

skipping non-regular file "15-symlink-ownership/symlink2"

skipping non-regular file "15-symlink-ownership/symlink3"

skipping non-regular file "70-extended-attrs/symlink-with-xattrs"

skipping non-regular file "90-fifo/some-fifo"

skipping non-regular file "95-devices/devvn0"

skipping non-regular file "95-devices/devzero"

I think we know that will be ugly, but let's look.

sudo ./bbouncer verify -d /Volumes/Src /Volumes/Dst

Verifying: basic-permissions ... FAIL (Critical)

Verifying: timestamps ... FAIL (Critical)

Verifying: symlinks ... stat: ./symlink1: stat: No such file or directory

FAIL (Critical)

Verifying: symlink-ownership ... FAIL

Verifying: hardlinks ... ok (Important)

Verifying: resource-forks ...

Sub-test: on files ... ok (Critical)

Sub-test: on hardlinked files ... FAIL (Important)

Verifying: finder-flags ... FAIL (Critical)

Verifying: finder-locks ... FAIL

Verifying: creation-date ... FAIL

Verifying: bsd-flags ... ok

Verifying: extended-attrs ...

Sub-test: on files ... ok (Important)

Sub-test: on directories ... ok (Important)

Sub-test: on symlinks ... FAIL

Verifying: access-control-lists ...

Sub-test: on files ... ok (Important)

Sub-test: on dirs ... ok (Important)

Verifying: fifo ... FAIL

Verifying: devices ... FAIL

Verifying: combo-tests ...

Sub-test: xattrs + rsrc forks ... ok

Sub-test: lots of metadata ... FAIL

Pfft, hardlink still fail, but so do things that passed before!

If you're going to use rsync, I recommend using MacPorts or compiling the latest version yourself. Looks like Apple needs to add the fileflags and crtimes patches and update to a protocol version 30 rsync. But until then, MacPorts is easy!

No comments:

Post a Comment