Proposed enhancement: --rewrite-symlinks

Matt McCutchen hashproduct at verizon.net
Tue Oct 4 16:02:10 GMT 2005


The following might be a nice addition to rsync.  Have an option
"--rewrite-symlinks" that causes rsync to rewrite relative symlinks so
that the source and destination symlinks point to the same places.

For example, I have a symlink "/home/matt/msync" that contains the path
"../sync-machinery/msync".  (Incidentally, msync is a nice two-way
synchronization script based on rsync.)  I wanted to install this link
into /usr/local/bin so that other people on my machine could access the
program, so I rsync-ed it into /usr/local/bin with -l.  The link path
still read "../sync-machinery/msync", so the link was broken.  If I had
supplied "--rewrite-symlinks" (and rsync supported it), the path should
have been rewritten to "../../../home/matt/sync-machinery/msync".

I think a symlink should only be rewritten if it points outside the
transfer.  Maybe there should be other rules based on whether the source
symlink is broken and/or whether the destination symlink would be broken
if it weren't rewritten.  Obviously, there's no way to symlink to
another computer, so rewriting symlinks only makes sense for local
transfers.

Thoughts on this?
-- 
Matt McCutchen, ``hashproduct''
hashproduct at verizon.net -- http://mysite.verizon.net/hashproduct/



More information about the rsync mailing list