I was wondering if anyone would have any input on a patch to add
another command line feature, --omit-symlink-times. We recently ran
into a problem with rsync (at least with the way we use it):
- We need to preserve file modification times between the source and
destination (--preserve-times)
- The user performing the rsync may not always be the owner of the files
on the destination (but is in the same group, and all files have group
write permissions)
The problem arrises when using symlinks. Files are always recreated (as
the user performing the rsync) on the destination when the source file
has a later mtime, regardless of changes. Symlinks however, are NOT
recreated when the mtime differs; instead, the mtime is simply adjusted
on the destination. This is problematic because a user who does not own
a file or symlink can not adjust the mtime of the file to a time that
isn't time(NULL) (no), see utimes(2). Thus rsync fails with "failed to
set times on...". The rest of the rsync completes, but our scripts rely
on trusting the return codes.
I assume this is the same reason why the --omit-dir-times option exists:
because it is not trivial (or necessary) to recreate a directory to
update the mtime. So, my solution was to create a patch to add a
--omit-symlink-times option, which simply skips trying to preserve the
mtime on symlinks. It works exactly like the --omit-dir-times option.
My question is:
- Is there another way around this (such as forcing rsync to recreate
symlinks that haven't "changed")?
- Would you be interested in applying the patch to the rsync source tree?
Thanks!
Steve Polyack