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

--files-from doesn't seem to play nicely with --links #7816

Open
tlemo opened this issue Apr 30, 2024 · 2 comments
Open

--files-from doesn't seem to play nicely with --links #7816

tlemo opened this issue Apr 30, 2024 · 2 comments

Comments

@tlemo
Copy link

tlemo commented Apr 30, 2024

When used together with --links, the --files-from filtering is demonstrating an unfortunate behavior: symlinks paths will be ignored. It appears that the filtering is applied after the .rclonelink mapping of the original names (so filtering on the "augmented" name works).

It's not clear if this behavior is intended or simply a bug, but it is both surprising as is unfortunate, since it requires clients to be aware of the difference between regular files and symlinks. Moreover, it's fragile in the face of changing a regular file to a symlink.

Ideally, the --files-from filtering should work on the original file paths.

To reproduce the problem, simply create a directory with a file and a symlink pointing to it, for example:

test/
  bar.txt -> foo.txt
  foo.txt

and a files with the content:

foo.txt
bar.txt
rclone sync --log-level DEBUG --progress --links --files-from files test x:/test
rclone v1.66.0
- os/version: ubuntu 18.04 (64 bit)
- os/kernel: 4.15.0-213-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.22.1
- go/linking: static
- go/tags: none
@ncw
Copy link
Member

ncw commented May 13, 2024

The way to refer to a symlink in a --files-from when --links is active is this

foo.txt
bar.txt.rclonelink

Those are the names as rclone sees them if you use the --links parameter and all filtering works on the names that rclone sees.

If you really aren't sure whether bar.txt is a symlink or not you could do something like --include "/bar.txt{,.rclonelink}"

@tlemo
Copy link
Author

tlemo commented May 13, 2024

Thanks for the suggestions. I have implemented a workaround (unfortunately boiling down to replacing rclone's filtering altogether) - I opened this issue hoping that it might provide useful feedback for improving rclone's filtering.

If you really aren't sure whether bar.txt is a symlink or not you could do something like --include "/bar.txt{,.rclonelink}"

Every path could potentially be a symlink (or change between a regular to a symlink). Wouldn't make more sense to abstract this away instead of forcing this awkward pattern matching for every path? (I don't have a chance to try it right now, does the pattern matching even work with --files-from?)

Those are the names as rclone sees them if you use the --links parameter

This describes an implementation detail. Is there a fundamental reason why the users have to be exposed to it?

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