samba-bugs at samba.org
2016-Feb-09 12:45 UTC
[Bug 11726] New: --copy-links cause rsync to fail with ancestor symlink (..)
https://bugzilla.samba.org/show_bug.cgi?id=11726 Bug ID: 11726 Summary: --copy-links cause rsync to fail with ancestor symlink (..) Product: rsync Version: 3.1.2 Hardware: All OS: All Status: NEW Severity: major Priority: P5 Component: core Assignee: wayned at samba.org Reporter: cyphar at cyphar.com QA Contact: rsync-qa at samba.org If you have a directory created like so: % mkdir -p from/dir/ % ln -s .. from/dir/loop % rsync -a --copy-links from to rsync: readlink_stat("/tmp/from/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop/dir/loop") failed: Too many levels of symbolic links (40) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2] For a trivial case of infinitely recursive symlinks (in other words when you go through a symlink that takes you to an ancestor), rsync should just declare "that's as far as we need to go here". -- You are receiving this mail because: You are the QA Contact for the bug.
samba-bugs at samba.org
2016-Feb-09 13:01 UTC
[Bug 11726] --copy-links cause rsync to fail with ancestor symlink (..)
https://bugzilla.samba.org/show_bug.cgi?id=11726 --- Comment #1 from cyphar at cyphar.com --- I'm working on writing a patch for this (although this is my first time looking at the rsync codebase, so it might take a while). I'll ping this thread if I'm unable to write one. -- You are receiving this mail because: You are the QA Contact for the bug.
samba-bugs at samba.org
2016-Feb-09 18:13 UTC
[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)
https://bugzilla.samba.org/show_bug.cgi?id=11726 --- Comment #2 from cyphar at cyphar.com --- It turns out that this issue also happens even when you don't use --copy-link (albeit a different error): % rsync -a from to cannot delete non-empty directory: from/dir/loop could not make way for new symlink: from/dir/loop rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.3dev] -- You are receiving this mail because: You are the QA Contact for the bug.
samba-bugs at samba.org
2016-Feb-10 04:45 UTC
[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)
https://bugzilla.samba.org/show_bug.cgi?id=11726 Wayne Davison <wayned at samba.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |WONTFIX Status|NEW |RESOLVED --- Comment #3 from Wayne Davison <wayned at samba.org> --- Yes, if you tell rsync to copy the symlinks it does it. If you have one or more looping symlinks then you need to exclude them from the copy or not use --copy-links. As for the other error, you need to use --delete or --force to copy over a non-empty directory, as mentioned in the man page. -- You are receiving this mail because: You are the QA Contact for the bug.
samba-bugs at samba.org
2016-Feb-10 04:48 UTC
[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)
https://bugzilla.samba.org/show_bug.cgi?id=11726 --- Comment #4 from cyphar at cyphar.com --- (In reply to Wayne Davison from comment #3)> Yes, if you tell rsync to copy the symlinks it does it. If you have one or more looping symlinks then you need to exclude them from the copy or not use --copy-links.That's just patently ridiculous. cp -r doesn't fail when you ask it to copy a directory that has symlink loops because "that's what you asked me to do". It literally just takes doing some fairly trivial checks before adding extra files to file_list (i.e. does the path we're adding resolve to an ancestor of a path we've already seen?). -- You are receiving this mail because: You are the QA Contact for the bug.
samba-bugs at samba.org
2016-Feb-10 10:49 UTC
[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)
https://bugzilla.samba.org/show_bug.cgi?id=11726 cyphar at cyphar.com changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|WONTFIX |--- Status|RESOLVED |REOPENED -- You are receiving this mail because: You are the QA Contact for the bug.
samba-bugs at samba.org
2016-Feb-11 09:55 UTC
[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)
https://bugzilla.samba.org/show_bug.cgi?id=11726 Wayne Davison <wayned at samba.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |WONTFIX -- You are receiving this mail because: You are the QA Contact for the bug.
samba-bugs at samba.org
2016-Feb-11 16:06 UTC
[Bug 11726] rsync fails to copy directory containing ancestor symlink with --copy-links
https://bugzilla.samba.org/show_bug.cgi?id=11726 Wayne Davison <wayned at samba.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|rsync fails to copy |rsync fails to copy |directory containing |directory containing |ancestor symlink (..) |ancestor symlink with | |--copy-links --- Comment #5 from Wayne Davison <wayned at samba.org> --- Keep in mind that "cp -r" doesn't dereference symlinks -- that takes their -L option (similar to rsync's --copy-links). If someone is copying a file tree and turning symlinks into real files/dirs, they should really know in advance what the symlinks are in order for the copy to be safe. Yes, we could stop looping with some additional checks. It might be worth it to at least not follow '.' and "..". -- You are receiving this mail because: You are the QA Contact for the bug.
Possibly Parallel Threads
- DO NOT REPLY [Bug 5199] New: Exclusion of source arg ancestor short-circuits recursion
- [Bug 8336] New: parent dir permission
- Newbie seeks helps ordering ancestors from acts_as_tree
- DO NOT REPLY [Bug 6927] New: Add a --fat option to ignore 1-second time diffs, ownership, hard links, symlinks, etc.
- DO NOT REPLY [Bug 7109] New: Need to define NO_SYMLINK_XATTR on Linux