-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-testsuiteArea: The testsuite used to check the correctness of rustcArea: The testsuite used to check the correctness of rustcneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
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.
rust/library/test/src/term/terminfo/searcher/tests.rs
Lines 13 to 20 in f2bae99
| 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"); | |
| } |
rust/library/std/src/process/tests.rs
Lines 326 to 332 in 8c32e31
| unsafe { | |
| env::set_var("RUN_TEST_NEW_ENV2", "456"); | |
| } | |
| let result = cmd.output().unwrap(); | |
| unsafe { | |
| env::remove_var("RUN_TEST_NEW_ENV2"); | |
| } |
Line 571 in ef20a1b
| /// unsafe { env::set_var("PATH", &new_path); } |
The last example is even in user-facing documentation.
Metadata
Metadata
Assignees
Labels
A-testsuiteArea: The testsuite used to check the correctness of rustcArea: The testsuite used to check the correctness of rustcneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.