Adding diagnostic item markers for multiple fs functions and structs - #160489
Conversation
|
r? @clarfonthey rustbot has assigned @clarfonthey. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Sorry for taking a bit to get to this, but this looks fine to me. I assume that the |
I'm not sure why the |
…ejrs Adding diagnostic item markers for multiple fs functions and structs 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::metdata` after `Path::exists`](rust-lang/rust-clippy#17158) * [opening multiple files under a directory without using `open_at`](rust-lang/rust-clippy#17156) * [File deletion followed by file creation](rust-lang/rust-clippy#17153) * [File path comparison without canonicalizing](rust-lang/rust-clippy#17155) * [File creation followed by setting permissions](rust-lang/rust-clippy#17154) (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.
…uwer Rollup of 8 pull requests Successful merges: - #154210 (fix: fix the capture behavior of `if let` in closures) - #156176 (Initial implementation of `FnPtr` trait) - #160767 (Unify E0117 foreign-trait label for ADT/primitive types with existing Slice/Array/Tuple handling) - #160489 (Adding diagnostic item markers for multiple fs functions and structs) - #161220 (bootstrap: Allow `./x fix --allow-dirty`) - #161291 (Rename `ProjectionPredicate` and `TraitPredicate`) - #161296 (Enable overflow checks in `rustc_thread_pool`) - #161304 (Rename test so it matches the issue)
…ejrs Adding diagnostic item markers for multiple fs functions and structs 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::metdata` after `Path::exists`](rust-lang/rust-clippy#17158) * [opening multiple files under a directory without using `open_at`](rust-lang/rust-clippy#17156) * [File deletion followed by file creation](rust-lang/rust-clippy#17153) * [File path comparison without canonicalizing](rust-lang/rust-clippy#17155) * [File creation followed by setting permissions](rust-lang/rust-clippy#17154) (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.
…ejrs Adding diagnostic item markers for multiple fs functions and structs 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::metdata` after `Path::exists`](rust-lang/rust-clippy#17158) * [opening multiple files under a directory without using `open_at`](rust-lang/rust-clippy#17156) * [File deletion followed by file creation](rust-lang/rust-clippy#17153) * [File path comparison without canonicalizing](rust-lang/rust-clippy#17155) * [File creation followed by setting permissions](rust-lang/rust-clippy#17154) (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.
Rollup of 18 pull requests Successful merges: - #154210 (fix: fix the capture behavior of `if let` in closures) - #156176 (Initial implementation of `FnPtr` trait) - #160767 (Unify E0117 foreign-trait label for ADT/primitive types with existing Slice/Array/Tuple handling) - #161297 (std: use UNIX's `Instant` and `SystemTime` on Hermit) - #160489 (Adding diagnostic item markers for multiple fs functions and structs) - #160643 (Require windowed (and exception) for Xtensa ABI) - #161088 (suppress projection errors already covered by a trait error) - #161114 (Remove fields from TypeKind: Struct, Enum, Union and Tuple) - #161115 (Assorted allocator nitpicks) - #161220 (bootstrap: Allow `./x fix --allow-dirty`) - #161296 (Enable overflow checks in `rustc_thread_pool`) - #161298 (remove rustc_error_messages dependency) - #161304 (Rename test so it matches the issue) - #161309 (`allow(non_camel_case_types)` in `minicore.rs`) - #161315 (Relax codgen test variable regex) - #161318 (Doc: clarify how `Read::bytes` handling Interrupted errors) - #161321 (Update books) - #161335 ([compiletest] Use the correct rustc lib directory for query_rustc_output)
Rollup merge of #160489 - asder8215:fs_diagnostic_items, r=mejrs Adding diagnostic item markers for multiple fs functions and structs 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::metdata` after `Path::exists`](rust-lang/rust-clippy#17158) * [opening multiple files under a directory without using `open_at`](rust-lang/rust-clippy#17156) * [File deletion followed by file creation](rust-lang/rust-clippy#17153) * [File path comparison without canonicalizing](rust-lang/rust-clippy#17155) * [File creation followed by setting permissions](rust-lang/rust-clippy#17154) (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.
Rollup of 18 pull requests Successful merges: - rust-lang/rust#154210 (fix: fix the capture behavior of `if let` in closures) - rust-lang/rust#156176 (Initial implementation of `FnPtr` trait) - rust-lang/rust#160767 (Unify E0117 foreign-trait label for ADT/primitive types with existing Slice/Array/Tuple handling) - rust-lang/rust#161297 (std: use UNIX's `Instant` and `SystemTime` on Hermit) - rust-lang/rust#160489 (Adding diagnostic item markers for multiple fs functions and structs) - rust-lang/rust#160643 (Require windowed (and exception) for Xtensa ABI) - rust-lang/rust#161088 (suppress projection errors already covered by a trait error) - rust-lang/rust#161114 (Remove fields from TypeKind: Struct, Enum, Union and Tuple) - rust-lang/rust#161115 (Assorted allocator nitpicks) - rust-lang/rust#161220 (bootstrap: Allow `./x fix --allow-dirty`) - rust-lang/rust#161296 (Enable overflow checks in `rustc_thread_pool`) - rust-lang/rust#161298 (remove rustc_error_messages dependency) - rust-lang/rust#161304 (Rename test so it matches the issue) - rust-lang/rust#161309 (`allow(non_camel_case_types)` in `minicore.rs`) - rust-lang/rust#161315 (Relax codgen test variable regex) - rust-lang/rust#161318 (Doc: clarify how `Read::bytes` handling Interrupted errors) - rust-lang/rust#161321 (Update books) - rust-lang/rust#161335 ([compiletest] Use the correct rustc lib directory for query_rustc_output)
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.