-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsA-environment-variablesArea: environment variablesArea: environment variablesC-bugCategory: bugCategory: bugO-windowsOS: WindowsOS: Windows
Description
I recently submitted a PR to stop Rust ASCII upper casing environment variables: rust-lang/rust#85270. This causes the following test to fail.
cargo/tests/testsuite/tool_paths.rs
Lines 360 to 373 in 3691752
| let target = rustc_host(); | |
| let env_key = format!( | |
| "CARGO_TARGET_{}_LINKER", | |
| target.to_lowercase().replace('-', "_") | |
| ); | |
| let mut execs = p.cargo("build -v --target"); | |
| execs.arg(target).env(&env_key, "nonexistent-linker"); | |
| if cfg!(windows) { | |
| // Windows env keys are case insensitive, so no warning, but it will | |
| // fail due to the missing linker. | |
| execs | |
| .with_stderr_does_not_contain("warning:[..]") | |
| .with_status(101); |
I think it's because something relies on a new process upper casing key names? Which only happened before because Rust manually ASCII upper cased keys when starting a new process.
Hm, that seems to be the assumption here:
cargo/src/cargo/util/config/mod.rs
Lines 698 to 703 in 3691752
| fn check_environment_key_case_mismatch(&self, key: &ConfigKey) { | |
| if cfg!(windows) { | |
| // In the case of windows the check for case mismatch in keys can be skipped | |
| // as windows already converts its environment keys into the desired format. | |
| return; | |
| } |
Whereas Windows itself does no such conversion.
cc @ehuss ? (only because you most recently touched the relevant test 🙂)
Metadata
Metadata
Assignees
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsA-environment-variablesArea: environment variablesArea: environment variablesC-bugCategory: bugCategory: bugO-windowsOS: WindowsOS: Windows