-
Notifications
You must be signed in to change notification settings - Fork 94
NEW: Add selection parser "--exclude-unreadable" #1063
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
base: master
Are you sure you want to change the base?
Conversation
|
@ericzolf If you agree with the principle, I will write a unit test to cover the new "--exclude-unreadable" selector. |
|
@ericzolf Sorry for the long list of small commits. At least everything is split into manageable chunks. The general idea here is to avoid calling os.lstat() on files that are excluded by --exclude ... and not re-included by any other pattern.
Your input is appreciated, as always. Just a heads-up: I’m heading off on vacation and will be back in late May. |
dc6d9f5 to
ab69d88
Compare
|
Before I review this PR, can you clarify why the PR merges into a branch which isn't master? |
I wanted to chain the pull requests because one change depends on the other. However, the changes are unrelated in terms of functionality. I'm not sure how to properly manage this kind of situation in GitHub. |
|
I generally keep it against master, put a note of the "chaining" for the reviewer, and potentially put it in draft mode until the base PR is merged. |
| Returns (rpath, num) where num == 0 means rpath should be | ||
| generated normally, num == 1 means the rpath is a directory | ||
| and should be included iff something inside is included. | ||
| and should be included if something inside is included. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| and should be included if something inside is included. | |
| and should be included iff something inside is included. |
Ha, I remember also as I struggled with this iff, but it's legit and means "if and only if", see https://en.wikipedia.org/wiki/If_and_only_if
|
I need to take a deeper look at the changes you've made, they're quite extensive, but one thought goes through my mind: why do we need an exclude-unreadable option? If a file is unreadable, we won't anyway be able to backup it (and rdiff-backup wouldn't choke on it, just send a warning). Is it only about avoiding warnings? Then I'd like another option and even approach, but we can talk about once you've clarified the purpose. |
Thanks, Eric, for taking the time to review. To answer your question—yes, the main goal is to avoid raising unnecessary warnings during the backup process. That was the initial motivation for this change. However, while working on it, I noticed that rdiff-backup calls lstat() even on files that are excluded. This shouldn't be necessary when the exclusion is based on filename patterns. In my scenario, this has a negative impact on performance because lstat() is still called on every file, even those that are excluded. |
|
On avoiding lstat, fine with me on the principle, I just need to find a bit more time to review it properly. On the exclude option, I don't like it so much:
Would it be possible to split both things and add the ignore option in another PR? |
|
I will split the PR in multiple pieces to make everything clear. That I agree. I like the idea of I'm open to suggestions. |
To reduce io calls and to avoid calling os.lstat on excluded files, run the selection functions in two pass. First pass only with filenames selection. Signed-off-by: Patrik Dufresne <[email protected]>
- Add implementation for a new selector to ignore unreadable file. - Make use of this new selector in fs_abilities to avoid raising permissions error Signed-off-by: Patrik Dufresne <[email protected]>
ab69d88 to
abe8355
Compare
|
@ericzolf Let me recap everything regarding these changes. The main issue I’m trying to resolve is the following: On Windows, when configured to back up This particular check attempts to determine if the filesystem supports resource forks. To do so, it needs to find a readable regular file on the filesystem. The current implementation relies on the default selection function to locate such a file, using: selection.Select(dir_rp).get_select_iter()However, this traverses the directory tree and, as a side effect, triggers warnings and errors for unreadable or locked files: This behavior is both annoying and confusing for users reviewing the logs. To mitigate this, my proposed solution in this pull request was to configure the selection function with the following options: That said, I acknowledge that this might not be the ideal fix. In hindsight, relying on the selection function inside I hope this make thing more clear. P.S.: This Pull Request depends on #1074 |
|
Could we close this PR and wait for the implementation of #1078 ? |
|
Give me some time to test it end to end in Minarca. I will mark this PR as draft for now. |
|
This is link to #1064 It all depends how we want to solve the error raised by resource_forks detection.. My initial idea was to create this new exclude and use it in resources forks. |
Changes done and why
Self-Checklist