-
Notifications
You must be signed in to change notification settings - Fork 13.3k
document remove_dir_all returning DirectoryNotEmpty on concurrent write #139958
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
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-filesystem
Area: `std::fs`
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Comments
@rustbot claim |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
May 1, 2025
…bilee std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into Closes rust-lang#139958 The current documentation for `std::fs::remove_dir_all` function does not explicitly mention the error types that may be returned in concurrent scenarios. Specifically, when one thread attempts to remove a directory tree while another thread simultaneously writes files to that directory, the function may return an `io::ErrorKind::DirectoryNotEmpty` error, but this behavior is not clearly mentioned in the current documentation. r? libs
Zalathar
added a commit
to Zalathar/rust
that referenced
this issue
May 1, 2025
…bilee std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into Closes rust-lang#139958 The current documentation for `std::fs::remove_dir_all` function does not explicitly mention the error types that may be returned in concurrent scenarios. Specifically, when one thread attempts to remove a directory tree while another thread simultaneously writes files to that directory, the function may return an `io::ErrorKind::DirectoryNotEmpty` error, but this behavior is not clearly mentioned in the current documentation. r? libs
Zalathar
added a commit
to Zalathar/rust
that referenced
this issue
May 1, 2025
…bilee std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into Closes rust-lang#139958 The current documentation for `std::fs::remove_dir_all` function does not explicitly mention the error types that may be returned in concurrent scenarios. Specifically, when one thread attempts to remove a directory tree while another thread simultaneously writes files to that directory, the function may return an `io::ErrorKind::DirectoryNotEmpty` error, but this behavior is not clearly mentioned in the current documentation. r? libs
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
May 1, 2025
…bilee std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into Closes rust-lang#139958 The current documentation for `std::fs::remove_dir_all` function does not explicitly mention the error types that may be returned in concurrent scenarios. Specifically, when one thread attempts to remove a directory tree while another thread simultaneously writes files to that directory, the function may return an `io::ErrorKind::DirectoryNotEmpty` error, but this behavior is not clearly mentioned in the current documentation. r? libs
VlaDexa
added a commit
to VlaDexa/rust
that referenced
this issue
May 2, 2025
…bilee std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into Closes rust-lang#139958 The current documentation for `std::fs::remove_dir_all` function does not explicitly mention the error types that may be returned in concurrent scenarios. Specifically, when one thread attempts to remove a directory tree while another thread simultaneously writes files to that directory, the function may return an `io::ErrorKind::DirectoryNotEmpty` error, but this behavior is not clearly mentioned in the current documentation. r? libs
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 2, 2025
Rollup merge of rust-lang#140062 - xizheyin:issue-139958, r=workingjubilee std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into Closes rust-lang#139958 The current documentation for `std::fs::remove_dir_all` function does not explicitly mention the error types that may be returned in concurrent scenarios. Specifically, when one thread attempts to remove a directory tree while another thread simultaneously writes files to that directory, the function may return an `io::ErrorKind::DirectoryNotEmpty` error, but this behavior is not clearly mentioned in the current documentation. r? libs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-filesystem
Area: `std::fs`
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Location
https://doc.rust-lang.org/std/fs/fn.remove_dir_all.html
Summary
remove_dir_all
can fail withDirectoryNotEmpty
. This is somewhat implied by this sentence:but when diagnosing an issue related to this function, it really didn't seem to me that
DirectoryNotEmpty
was an error this function could ever return, especially given the detailed error section, and a platform-specific section mentioning being TOCTOU free (note: i wouldn't consider this a TOCTOU vuln by any mean, but it implied to me a stronger kind of handling for concurrent access than there is).error reproducer:
I think the last line of the Error section could be rewritten as:
The text was updated successfully, but these errors were encountered: