Re: rsync handling of symlinks
Andrew Tridgell via rsync <[email protected]> Sun, 31 May 2026 18:45:12 +1000
| Newsgroups | gmane.network.rsync.general |
|---|---|
| Message-ID | <CAAbv5GZACxruQPVcgWy3UQSmNPOuF5_H24tfRHTSJDSeXv1gqQ@mail.gmail.com> |
Hi Frank, I think the description of your issue may be a bit off. You list the command line as including the -U option with rsync 3.1.3, but the -U (aka --atimes) option wasn't added till 3.2.2. Meanwhile I added a test for your scenario here: https://github.com/RsyncProject/rsync/pull/935 I'm in a testsuite mood at the moment, trying to expand to cover interesting use cases. I suspect you were using --safe-links to get the behaviour you describe. With --safe-links if you have a link ~/a/b/test_link which points at ~/a/a/linked_file then it is rejected by --safe-links as the link goes via an unsafe location (the ~ expands to your home directory, so likely starts with a / ). It is not the final destination of the link that matters, it is how the link gets there. Cheers, Tridge On Sun, 31 May 2026 at 13:00, Frank Mills via rsync <[email protected]> wrote: > > I haven't found any postings on this in an internet search and the empirical behavior doesn't seem to match what's described in the man page. The system is running rsync version 3.1.3 protocol version 31. > > I created a test directory and tried several rsync parameters (such as -a). After working through the error messages that were generated, the following did not generate errors. > > rsync -rLkHtUuv --log-file=abc_test.txt ~/a/b/ c >& abc_err.txt > > > > Within the source directory is a symlink that points to another file within the same directory. > > ~/a/b/test_link -> ~/a/b/linked_file > > > > The above rsync options correctly change the symlink to a file whose content is the same as the target file. So, these rsync options are operating as expected. > > > > Where I get behavior that doesn't seem to match documentation is when I try to keep symlinks as symlinks. > > rsync -rltUv --log-file=abc_test.txt ~/a/b/ c >& abc_err.txt > > > > In the copied directory, the symlink that was in the original directory has been omitted and the symlink has not been replaced by the target file. I get similar behavior with rsync -a. > > > > Since the target and symlink are in the same directory, my understanding from the man page is that rsync should copy the symlink as a symlink. Any suggestions for how to preserve symlinks that are within the directory structure being copied? Thanks. > > > -- > Please use reply-all for most replies to avoid omitting the mailing list. > To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html