Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[beta-1.69] backport #11824 #11863

Merged
merged 1 commit into from
Mar 17, 2023
Merged

Commits on Mar 17, 2023

  1. Auto merge of rust-lang#11824 - kylematsuda:windows-config-env-fix, r…

    …=ehuss
    
    Handle case mismatches when looking up env vars in the Config snapshot
    
    ### What does this PR try to resolve?
    
    Fixes rust-lang#11814.
    
    Windows environment variables are case-insensitive, which causes problems when looking them up in the `Config` env snapshot.
    
    This PR adds another member (`case_insensitive_env`) in `Config` that maps upper-cased keys to their original values in the env (for example, `"PATH" => "Path"`). If lookup in `self.env` fails, this PR converts the key to upper case and looks it up in `self.case_insensitive_env` to obtain the correct key name if it exists (on Windows only).
    
    ### How should we test and review this PR?
    
    Please see the new tests in `testsuite/config.rs` and `testsuite/cargo_command.rs`.
    
    ### Additional information
    
    Currently, this uses `str::to_uppercase` to uppercase the keys. This requires key to be valid UTF-8, and may disagree with how the OS uppercases things (see the link in [this comment](rust-lang#11814 (comment)) for details).
    bors authored and weihanglo committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    a02ca0d View commit details
    Browse the repository at this point in the history