Skip to content

Conversation

weihanglo
Copy link
Member

Beta backports:

In order to make CI pass, the following PRs are also cherry-picked:

…=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).
@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2023

r? @epage

(rustbot has picked a reviewer for you, use r? to override)

@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2023

⚠️ Warning ⚠️

  • Pull requests are usually filed against the master branch for this repo, but this one is against rust-1.69.0. Please double check that you specified the right target!

@rustbot rustbot added A-configuration Area: cargo config files and env vars S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 17, 2023
@ehuss
Copy link
Contributor

ehuss commented Mar 17, 2023

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Mar 17, 2023

📌 Commit a02ca0d has been approved by ehuss

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 17, 2023
@bors
Copy link
Contributor

bors commented Mar 17, 2023

⌛ Testing commit a02ca0d with merge 7b18c85...

@bors
Copy link
Contributor

bors commented Mar 17, 2023

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing 7b18c85 to rust-1.69.0...

@bors bors merged commit 7b18c85 into rust-lang:rust-1.69.0 Mar 17, 2023
@weihanglo weihanglo deleted the rust-1.69.0 branch March 17, 2023 13:40
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 19, 2023
…nglo

[beta-1.69] cargo beta backports

3 commits in 9880b408a3af50c08fab3dbf4aa2a972df71e951..7b18c85808a6b45ec8364bf730617b6f13e0f9f8
2023-02-28 19:39:39 +0000 to 2023-03-17 12:29:33 +0000
- [beta-1.69] backport rust-lang/cargo#11824 (rust-lang/cargo#11863)
- [beta-1.69] backport rust-lang/cargo#11820 (rust-lang/cargo#11823)
- chore: Backport rust-lang/cargo#11630 to `1.69.0` (rust-lang/cargo#11806)

r? `@ghost`
@ehuss ehuss added this to the 1.69.0 milestone Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-configuration Area: cargo config files and env vars S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants