[Bug 11726] New: --copy-links cause rsync to fail with ancestor symlink (..)

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 11726] New: --copy-links cause rsync to fail with ancestor symlink (..)

samba-bugs
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: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]

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.

--
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
Reply | Threaded
Open this post in threaded view
|

[Bug 11726] --copy-links cause rsync to fail with ancestor symlink (..)

samba-bugs
https://bugzilla.samba.org/show_bug.cgi?id=11726

--- Comment #1 from [hidden email] ---
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.

--
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
Reply | Threaded
Open this post in threaded view
|

[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)

samba-bugs
In reply to this post by samba-bugs
https://bugzilla.samba.org/show_bug.cgi?id=11726

--- Comment #2 from [hidden email] ---
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.

--
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
Reply | Threaded
Open this post in threaded view
|

[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)

samba-bugs
In reply to this post by samba-bugs
https://bugzilla.samba.org/show_bug.cgi?id=11726

Wayne Davison <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #3 from Wayne Davison <[hidden email]> ---
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.

--
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
Reply | Threaded
Open this post in threaded view
|

[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)

samba-bugs
In reply to this post by samba-bugs
https://bugzilla.samba.org/show_bug.cgi?id=11726

--- Comment #4 from [hidden email] ---
(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.

--
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
Reply | Threaded
Open this post in threaded view
|

[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)

samba-bugs
In reply to this post by samba-bugs
https://bugzilla.samba.org/show_bug.cgi?id=11726

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WONTFIX                     |---
             Status|RESOLVED                    |REOPENED

--
You are receiving this mail because:
You are the QA Contact for the bug.

--
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
Reply | Threaded
Open this post in threaded view
|

[Bug 11726] rsync fails to copy directory containing ancestor symlink (..)

samba-bugs
In reply to this post by samba-bugs
https://bugzilla.samba.org/show_bug.cgi?id=11726

Wayne Davison <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |WONTFIX

--
You are receiving this mail because:
You are the QA Contact for the bug.

--
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
Reply | Threaded
Open this post in threaded view
|

[Bug 11726] rsync fails to copy directory containing ancestor symlink with --copy-links

samba-bugs
In reply to this post by samba-bugs
https://bugzilla.samba.org/show_bug.cgi?id=11726

Wayne Davison <[hidden email]> 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 <[hidden email]> ---
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.

--
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