Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concurrent use of multiple symbolic link handling modes #274

Closed
twojstaryzdomu opened this issue Jan 11, 2022 · 3 comments
Closed

concurrent use of multiple symbolic link handling modes #274

twojstaryzdomu opened this issue Jan 11, 2022 · 3 comments

Comments

@twojstaryzdomu
Copy link

twojstaryzdomu commented Jan 11, 2022

Symbolic link handling modes may be combined but do not appear to produce any failures or warnings, clarifying which symlink handling mode is in effect. Such behaviour may call for an error, if not intentional, a warning or a documentation change.

E.g. With --links and --copy-links enabled, --copy-links prevails.

# mkdir source destination
# touch source/referent
# ln -s referent source/link
# file source/link
source/link: symbolic link to referent
# rsync -ir --links --copy-links source/ destination/
>f+++++++++ link
>f+++++++++ referent
# file destination/link
destination/link: empty

Similar precedence is seen for --update-links (i.e. copy symlink only if more recent) from PR #198. --update-links effects prevail over --copy-links (transfer the referent of the symlink as symlink name).

# mkdir source destination
# touch source/referent
# ln -s referent source/link
# file source/link
source/link: symbolic link to referent
# rsync -ir --copy-links --update-links source/ destination/
cL+++++++++ link -> referent
>f+++++++++ referent
# file destination/link
destination/link: symbolic link to referent

Parameter order appears to be irrelevant.

# rsync -ir --copy-links --links source/ destination/
>f+++++++++ link
>f+++++++++ referent
# file destination/link
destination/link: empty
@twojstaryzdomu
Copy link
Author

Documented order of precedence rules for symbolic link handling modes in 1af2237.

@WayneD
Copy link
Member

WayneD commented Jan 13, 2022

In the man page section on symbolic links it has a summary of how the symlink options interact. It was missing --copy-dirlinks, --munge-links, and --keep-dirlinks, so I added those. I also added some info to each separate option to mention a bit about interactions and point to the symlink section.

As for --update-links (which isn't official) I pointed out in a comment on the pull-request that it was erroneously overriding --copy-links when it shouldn't.

The latest git has the man page improvements.

@WayneD WayneD closed this as completed Jan 13, 2022
@twojstaryzdomu
Copy link
Author

To --update-link's overriding --copy-links, it goes back to the observation made with --copy-links prevailing over --links. Being a more recent option, picking --update-links would naturally stem from an informed choice by a user to use it over a former option.

That said, the best case may be to do away with allowing mutually exclusive link modes being specified at once on the command line or throw a warning at the very least, stating which mode is in use whenever two or more are given. The warnings gnu find presents on overriding options given after positional parameters come to mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants