logo

Rust crates reviews

Cryptographically verifiable, distributed dependency reviews

crate: tempfile

https://lib.rs/crates/tempfile/

Add the last reviewed version to Cargo.toml / [dependencies]:

tempfile = "3.3.0"

Filter reviews clicking on the numbers in the summary.

Full column names in tooltip hints: rating Negative, rating Neutral, rating Positive, rating Strong, thoroughness, understanding, reviews count.

Neg
Neu
Pos
Str
tho
und
rev
1
5
1
1
1
2
1
crate version
rating
date
reviewer
thoroughness, understanding
tempfile 3.3.0
positive
2022-11-04
low, medium
tempfile 3.2.0
positive
2021-03-20
low, medium

The unsafes all look good and are not trivial to replace (tried the ASCII
string composition, but the compiler can't optimize away from_utf8's error
by seeing through into the possible random values.

Average understanding is medium, I don't know the APIs underlying the Windows
implementation.

tempfile 3.1.0
positive
2019-08-25
low, medium

LGTM. I feel like this crate could use more in-depth review since it does have some unsafe blocks (especially for Windows).

tempfile 3.1.0
positive
2019-08-14
medium, medium

Solid crate overall.

Concerns:

  • Absurdly high default NUM_RETRIES means this crate can hang.
  • Slightly unnecessarily large unsafe use, used once without clear need.
  • TempDir seems like a big footgun.
  • Well documented footguns with regards to share tmp dirs on some systems.
  • Hazard to reproducable builds thanks to random filename generation.

Detail

FileRatingNotes
src/file/imp/mod.rs+1
src/file/imp/other.rs+1not_supported
src/file/imp/unix.rs+1unsafe, but sound.
src/file/imp/windows.rs+1unsafe, but sound.
src/file/mod.rs+1
src/dir.rs+1
src/error.rs+1
src/lib.rs+1
src/spooled.rs+1Could use a .into_file()
src/util.rs0unsafe, but sound.
tests/namedtempfile.rs+1
tests/spooled.rs+1
tests/tempdir.rs+1
tests/tempfile.rs+1
.gitignore+1
Cargo.toml+1
Cargo.toml.orig+1
LICENSE-APACHE+1
LICENSE-MIT+1
NEWS+1
README.​md+1
OtherRatingNotes
unsafe0Minor unnecessary/overlong unsafe blocks
fs0Rationale of this entire crate
io+1All looks sane
docs+1Tons of doc comments
tests+1Lots of 'em

src/file/imp/unix.rs

LineWhatNotes
15cvt_err+1, verified error handling is correct vs online man pages for rename and link.
25cvt_err+1
30cstr+1
35create_named+1
44create_unlinked+1
62create+1, sane flag use.
79create+1
83create_unix+1, minor hazard to reproducable builds due to random filenames
93reopen+1
107persist0, unsafe larger than necessary, but sound.
130persist0, redox NYI but sane placeholder error
135keep0, nothing to do on unix

src/file/imp/windows.rs

LineWhatNotes
19to_utf16+1, null terminates
23create_named+1
32create+1, minor hazard to reproducable builds due to random filenames
50reopen+1, unsafe but sound. Verified error handling vs MSDN.
67keep+1, unsafe but sound. Verified error handling vs MSDN.
78persist0, unsafe larger than necessary, but sound. Verified error handling vs MSDN.

src/file/mod.rs

LineWhatNotes
...*+1, well reviewed despite my lack of notes.
587new_in+1, doc comment links wrong method (new_in instead of new)
...*+1, well reviewed despite my lack of notes.
859into_file0, confusing how to use these correctly as Drop still occurs
867into_temp_path0, confusing how to use these correctly as Drop still occurs
876into_parts0, confusing how to use these correctly as Drop still occurs
...*+1, well reviewed despite my lack of notes.

src/lib.rs

LineWhatNotes
...*+1, well reviewed despite my lack of notes.
131NUM_RETRIES-1, absurdly large default value 1 << 31, will hang "forever".
...*+1, well reviewed despite my lack of notes.

src/util.rs

LineWhatNotes
9tmpname0, unsafe for semi-pointless str::from_utf8_unchecked, but sound. Reproducable builds hazard.
26create_helper+1, although I'd pick a different error message.

TIL

let tmp;
if cond {
    tmp = asdf;
    &tmp
}
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
    f.debug_struct("TempDir")
        .field("path", &self.path())
        .finish()
}
tempfile 3.0.4
positive
2018-12-26
low, medium

LGTM. I feel like this crate could use more in-depth review since it does have some unsafe blocks (especially for Windows).

© bestia.dev 2023, MIT License, Version: 2023.608.1636

Open source repository for this web app: https://github.com/bestia-dev/cargo_crev_web/