-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
std::fs::remove_dir_all
fails if any of the intermediate file deletions fails with ENOENT
#127576
Comments
Are you suggesting that this should continue removing files if one fails but still report an error, or that specifically ENOENT on a file should be considered a success? I assume this can happen if racing with another removal operation, not sure if there is a precedent for what to do here (rm?). @rustbot label +T-libs +C-bug +O-unix +A-filesystem -needs-triage |
Just checked what rm does when this happens (by making a lot of files and having two
So doing the same seems probably fine here, think this should be pretty easy. Ideally this should have a regression test, I'm not sure what the best way to do that is - @tbu- how did you identify or reproduce this? @rustbot label +E-easy |
I looked at the code for TOCTOU issues and found this particular problem. Nothing automatable I'm afraid. |
Specifically
Yes, this is about racing. E.g. |
This seems like it's just an implementation bug so fixes would be welcome. On Windows we do ignore not found errors when deleting files in |
@rustbot claim |
…=Amanieu fix: fs::remove_dir_all: treat internal ENOENT as success fixes rust-lang#127576
…try> fix: fs::remove_dir_all: treat internal ENOENT as success fixes rust-lang#127576 try-job: test-various
…=Amanieu fix: fs::remove_dir_all: treat internal ENOENT as success fixes rust-lang#127576 try-job: test-various
…=Amanieu fix: fs::remove_dir_all: treat internal ENOENT as success fixes rust-lang#127576 try-job: test-various
…=Amanieu fix: fs::remove_dir_all: treat internal ENOENT as success fixes rust-lang#127576 try-job: test-various
Rollup merge of rust-lang#127623 - lolbinarycat:fix_remove_dir_all, r=Amanieu fix: fs::remove_dir_all: treat internal ENOENT as success fixes rust-lang#127576 try-job: test-various
rust/library/std/src/sys/pal/unix/fs.rs
Line 2144 in d819876
rust/library/std/src/sys/pal/unix/fs.rs
Lines 2156 to 2159 in d819876
The text was updated successfully, but these errors were encountered: