You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(There are more TOCTOU/filesystem bug lints that could be made aside from the list above, e.g. with symlinks).
I was particularly interested in working on the last issue on file creation followed by setting permissions. However, I don't think I could start working on it without diagnostic items on filesystem functions like fs::set_permissions or fs::create_dir_all. I decided to put diagnostic item attributes on all the filesystem functions and a couple of the structs because they may be useful in creating clippy lints against TOCTOU bugs or other relevant filesystem operation bugs.
rustbot has assigned @clarfonthey.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
Why was this reviewer chosen?
The reviewer was selected based on:
Owners of files modified in this PR: @ChrisDenton, libs
@ChrisDenton, libs expanded to 13 candidates
Random selection from 6 candidates
rustbot
added
O-unix
Operating system: Unix-like
O-wasi
Operating system: Wasi, Webassembly System Interface
O-wasm
Target: WASM (WebAssembly), http://webassembly.org/
O-windows
Operating system: Windows
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
labels
Aug 4, 2026
Sorry for taking a bit to get to this, but this looks fine to me. I assume that the cfg_attr(not(test), …) is because in those cases, std is doubled (compiler std + currently-tested `std) and it messes things up?
I assume that the cfg_attr(not(test), …) is because in those cases, std is doubled (compiler std + currently-tested `std) and it messes things up?
I'm not sure why the cfg_attr(not(test), ...), I just took this off how it's done for other filesystem functions/structs (e.g. create_dir is marked with #[cfg_attr(not(test), rustc_diagnostic_item = "fs_create_dir")]). I figured that was the pattern we should follow with adding diagnostic items to fs functions/structs.
This file contains hidden or 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
O-unixOperating system: Unix-likeO-wasiOperating system: Wasi, Webassembly System InterfaceO-wasmTarget: WASM (WebAssembly), http://webassembly.org/O-windowsOperating system: WindowsS-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.T-libsRelevant to the library team, which will review and decide on the PR/issue.
3 participants
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.
A couple months ago there were a good number of TOCTOU/other filesystem lint issues created by @estebank in the clippy repo such as:
Path::metdataafterPath::existsopen_at(There are more TOCTOU/filesystem bug lints that could be made aside from the list above, e.g. with symlinks).
I was particularly interested in working on the last issue on file creation followed by setting permissions. However, I don't think I could start working on it without diagnostic items on filesystem functions like
fs::set_permissionsorfs::create_dir_all. I decided to put diagnostic item attributes on all the filesystem functions and a couple of the structs because they may be useful in creating clippy lints against TOCTOU bugs or other relevant filesystem operation bugs.