-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Ignore broken but excluded file during traversing #11008
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Walkdir's [`filter_entry()`][1] won't call the predicate if the entry is essentially an `Err` from its underyling `IntoIter`. That means Cargo hasn't had a chance to call `filter` on an entry that should be excluded but eventually return an `Err` and cause the loop to stop. For instance, a broken symlink which should bee excluded by `filter` will generate an error since `filter` closure is not called with it. The solution is calling `filter` if an error occurs with a path (because it has yet been called with that path). If it's exactly excluded, ignore the error. [1]: https://github.com/BurntSushi/walkdir/blob/abf3a15887758e0af54ebca827c7b6f8b311cb45/src/lib.rs#L1042-L1058
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Aug 20, 2022
@bors r+ |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Aug 21, 2022
☀️ Test successful - checks-actions |
Nice! |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 24, 2022
Update cargo 7 commits in 9809f8ff33c2b998919fd0432c626f0f7323697a..6da726708a4406f31f996d813790818dce837161 2022-08-16 22:10:06 +0000 to 2022-08-23 21:39:56 +0000 - Update non-ASCII crate name warning message (rust-lang/cargo#11017) - Add more tests for aggressive or precise update (rust-lang/cargo#11011) - Ignore broken but excluded file during traversing (rust-lang/cargo#11008) - Improve error message for wrong target names (rust-lang/cargo#10999) - Bump snapbox to 0.3 (rust-lang/cargo#11005) - remove missed reference to workspace inheritance in unstable.md (rust-lang/cargo#11001) - Warning when precise or aggressive without -p flag (rust-lang/cargo#10988)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
Fixes #10917
Walkdir's
filter_entry()
won't call the predicate if the entryis essentially an
Err
from its underylingIntoIter
. That meansCargo hasn't had a chance to call
filter
on an entry that should beexcluded but eventually return an
Err
and cause the loop to stop.For instance, a broken symlink which should bee excluded by
filter
will generate an error since
filter
closure is not called with it.The solution is calling
filter
if an error occurs with a path(because it has yet been called with that path).
If it's exactly excluded, ignore the error.
How should we test and review this PR?
Follow the reproducible steps in #10917
Additional information