Introduced by @ehuss in #136983 (36733f3, ef20a1b), apparently without double-checking whether these functions were actually safe to call.
Found when trying to audit whether this repository's calls to these unsafe environment variable functions were safe. It doesn't appear to be the case to me, e.g.
|
assert_eq!(get_dbpath_for_term(""), None); |
|
unsafe { |
|
env::set_var("TERMINFO_DIRS", ":"); |
|
} |
|
assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen")); |
|
unsafe { |
|
env::remove_var("TERMINFO_DIRS"); |
|
} |
|
unsafe { |
|
env::set_var("RUN_TEST_NEW_ENV2", "456"); |
|
} |
|
let result = cmd.output().unwrap(); |
|
unsafe { |
|
env::remove_var("RUN_TEST_NEW_ENV2"); |
|
} |
|
/// unsafe { env::set_var("PATH", &new_path); } |
The last example is even in user-facing documentation.
Introduced by @ehuss in #136983 (36733f3, ef20a1b), apparently without double-checking whether these functions were actually safe to call.
Found when trying to audit whether this repository's calls to these
unsafeenvironment variable functions were safe. It doesn't appear to be the case to me, e.g.rust/library/test/src/term/terminfo/searcher/tests.rs
Lines 13 to 20 in f2bae99
rust/library/std/src/process/tests.rs
Lines 326 to 332 in 8c32e31
rust/library/std/src/env.rs
Line 571 in ef20a1b
The last example is even in user-facing documentation.