Potential incompatibilities between '--delete' and --copy-unsafe-symlinks' ???

freedman at systems.cs.cornell.edu freedman at systems.cs.cornell.edu
Sat Aug 24 16:19:10 MDT 2013


New to this list, but long-time (appreciative) user of rsync.
Grateful for any help with my problem here...

In particular, I've been having long-standing issues (just now getting
around to trying to resolve them) when I use rsync with
'--copy-unsafe-links' alongside the '--delete' parameter.  If I use
either of these two parameters in isolation (along with other shared
parameters), I get the expected behavior.  However, when I use
'--copy-unsafe-links', rsync no longer properly deletes files that are
present in the destination, but not in the source.

The usage scenario is rsync (v 3.0.9, stock from Debian Wheezy)
getting called by rsnapshot (v 1.3.1, also Wheezy).  Rsync source and
destination are both on the same host (nothing remote at all in this
entire scenario), though they happen to be on different partitions.

As typical of rsnapshot, the destination directory for rsync is also
hard-linked to other directories (past daily/etc snapshots), so a
typical "new" rsnapshot invocation on my system (to create the more
recent 'daily.0' snapshot) has the following two key steps:

  /bin/cp -al /backup/daily.0 /backup/daily.1 
  /usr/bin/rsync -avvv --delete --numeric-ids --relative --delete-excluded \
    --copy-unsafe-links --exclude=*/.*~ --exclude=*/*~ \
    --exclude=/home/lost+found  <... more excludes ...> \
    /home /backup/daily.0/<hostname>/ 

In this above case, files that were deleted on '/home' between the
'daily.1' backup and the 'daily.0' backup (the following day) are
still incorrectly present in the new 'daily.0'.  However, if I remove
'--copy-unsafe-links' (through rsnapshot's appropriate configuration
file for passing parameters to rsync), then all functions as expected,
and file deletions on '/home' are properly mirrored in the updated
'daily.0' snapshot.

I've attempted to reproduce this in two ways:

  (1) I've called the above two commands (cp, then rsync) directly, on
      an appropriately prepared identical baseline of past rsnapshot
      'daily.<n>' directories.  In other words, this totally removes
      rsnapshot from the test setup.  I see the same behavior as
      described above, so it doesn't appear to be an rsnapshot bug.

  (2) I also fashioned a vastly smaller dataset (only a few
      directories / files, rather than all of '/home'), again calling
      rsync directly, rather than through rsnapshot.  Alas, in this
      case, I can't seem to trigger the problem.  <sigh> This might be
      because my simpler tests didn't involve multiple partitions, etc.

At this point, my lack of deeper familiarity with rsync has become
apparent to me, so I thought I'd turn to this mailing list.

Any suggestions / pointers / answers would be wonderful...  Happy to
provide more info as necessary, but I hope I touched on the big points

Thanks so much.. And thanks also for providing such a great tool!


More information about the rsync mailing list