Seth Olsen
2003-Jan-02 23:09 UTC
--copy-unsafe-links, links preserved in source tree or local directory?
Hi, I'm a bit confused about what the '--copy-unsafe-links' option considers the 'source tree'. In the man page it says that for links pointing outside the 'source tree' the file will be copied, but when I try this, for all links pointing outside of the local directory the files are copied even though the links point to files that are in the directory tree that is being rsynced. I couldn't find anything definitive on the web either. See the example below. Is this the expected behaviour? Is the 'source tree' just the current directory? If so, it would be nice to have an option where only links pointing outside of the 'parent source tree' ('Test' in the example below) would be copied as files. rsyc-2.5.4 on RedHat-7.3 i386, XFS filesystem Thanks, Seth olsen@gps.caltech.edu example: chump0:~> ll Test/* Test/Q1: total 0 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:05 q1_1 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:05 q1_2 lrwxrwxrwx 1 olsen olsen 4 Jan 2 14:06 q1_3 -> q1_2 lrwxrwxrwx 1 olsen olsen 24 Jan 2 14:09 q1_4 -> /home/olsen/Test/Q2/q2_1 lrwxrwxrwx 1 olsen olsen 15 Jan 2 14:42 q1_5 -> ../../test/qw.F Test/Q2: total 0 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:06 q2_1 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:06 q2_2 lrwxrwxrwx 1 olsen olsen 4 Jan 2 14:06 q2_3 -> q2_1 lrwxrwxrwx 1 olsen olsen 10 Jan 2 14:06 q2_4 -> ../Q1/q1_1 lrwxrwxrwx 1 olsen olsen 10 Jan 2 14:06 q2_5 -> ../Q1/q1_3 chump0:~> rsync -rl --copy-unsafe-links Test Test2 chump0:~> ll Test2/Test/* Test2/Test/Q1: total 4.0k -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q1_1 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q1_2 lrwxrwxrwx 1 olsen olsen 4 Jan 2 14:48 q1_3 -> q1_2 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q1_4 -rw-rw-r-- 1 olsen olsen 275 Jan 2 14:48 q1_5 Test2/Test/Q2: total 0 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q2_1 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q2_2 lrwxrwxrwx 1 olsen olsen 4 Jan 2 14:48 q2_3 -> q2_1 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q2_4 -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q2_5
Scott Mcdermott
2003-Jan-02 23:24 UTC
--copy-unsafe-links, links preserved in source tree or local directory?
Seth Olsen on Thu 2/01 15:02 -0800:> I'm a bit confused about what the '--copy-unsafe-links' option > considers the 'source tree'. In the man page it says that for links > pointing outside the 'source tree' the file will be copied,I think it means, any link that points to a location whose parent dirs don't eventually go back to the source dir.> but when I try this, for all links pointing outside of the local > directory the files are copied even though the links point to files > that are in the directory tree that is being rsynced.right, they are in the "source tree" so rsync copies them...you are using `l' flag right?> Is this the expected behaviour? Is the 'source tree' just the current > directory?rsync src dest
Dave Dykstra
2003-Jan-07 19:54 UTC
--copy-unsafe-links, links preserved in source tree or local directory?
That indeed is not right, and it appears that other people have noticed the problem before but nobody has come up with a fix. The problem must be related to the unsafe_symlink() function in util.c. Martin noticed a strange thing in the code (see http://lists.samba.org/pipermail/rsync/2002-April/006759.html) but I just tried his suggestion and it didn't help with your example. I'm sure I could figure it out if I spent more time on it but I've got other priorities right now. Try fiddling with it to see if you can come up with a better solution. It might help for you to build the t_unsafe test program that's in the Makefile but not built by default. I see Martin has also has a test for the option in testsuite/unsafe-links.test, and it would be good if that could be expanded to test for this case. - Dave On Thu, Jan 02, 2003 at 03:02:46PM -0800, Seth Olsen wrote:> > Hi, > > I'm a bit confused about what the '--copy-unsafe-links' option > considers the 'source tree'. In the man page it says that for links > pointing outside the 'source tree' the file will be copied, but when I > try this, for all links pointing outside of the local directory the > files are copied even though the links point to files that are in the > directory tree that is being rsynced. I couldn't find anything definitive > on the web either. See the example below. > > Is this the expected behaviour? Is the 'source tree' just the > current directory? If so, it would be nice to have an option where > only links pointing outside of the 'parent source tree' > ('Test' in the example below) would be copied as files. > > rsyc-2.5.4 on RedHat-7.3 i386, XFS filesystem > > Thanks, > > Seth > olsen@gps.caltech.edu > > example: > > chump0:~> ll Test/* > Test/Q1: > total 0 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:05 q1_1 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:05 q1_2 > lrwxrwxrwx 1 olsen olsen 4 Jan 2 14:06 q1_3 -> q1_2 > lrwxrwxrwx 1 olsen olsen 24 Jan 2 14:09 q1_4 -> /home/olsen/Test/Q2/q2_1 > lrwxrwxrwx 1 olsen olsen 15 Jan 2 14:42 q1_5 -> ../../test/qw.F > > Test/Q2: > total 0 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:06 q2_1 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:06 q2_2 > lrwxrwxrwx 1 olsen olsen 4 Jan 2 14:06 q2_3 -> q2_1 > lrwxrwxrwx 1 olsen olsen 10 Jan 2 14:06 q2_4 -> ../Q1/q1_1 > lrwxrwxrwx 1 olsen olsen 10 Jan 2 14:06 q2_5 -> ../Q1/q1_3 > > chump0:~> rsync -rl --copy-unsafe-links Test Test2 > > chump0:~> ll Test2/Test/* > Test2/Test/Q1: > total 4.0k > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q1_1 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q1_2 > lrwxrwxrwx 1 olsen olsen 4 Jan 2 14:48 q1_3 -> q1_2 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q1_4 > -rw-rw-r-- 1 olsen olsen 275 Jan 2 14:48 q1_5 > > Test2/Test/Q2: > total 0 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q2_1 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q2_2 > lrwxrwxrwx 1 olsen olsen 4 Jan 2 14:48 q2_3 -> q2_1 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q2_4 > -rw-rw-r-- 1 olsen olsen 0 Jan 2 14:48 q2_5 > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html