-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Handle case mismatches when looking up env vars in the Config snapshot #11824
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8353396
add unit test for config and integration test with cargo --list
kylematsuda 0255c30
store uppercased env var names; look for uppercased version on Window…
kylematsuda 3c8633a
change set_env to update case_insensitive_env and normalized_env (nee…
kylematsuda 8ae0773
use String instead of OsString in case_insensitive_env so we can use …
kylematsuda 35b53b8
add free function to generate auxiliary envs
kylematsuda f810234
factor out three hashmaps in Config into a new struct for better enca…
kylematsuda 7af55d8
improve docstrings for config::environment
kylematsuda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you say why these lines changed? I would not expect any changes to
normalized_env
.Though if you want to clean this up, it seems like it would be nicer to use
.keys()
instead of.iter()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, I meant to add a comment about this but forgot. I realized when I was looking back at #11727 that we might have accidentally subtly changed the behavior of
normalized_env
there.Before #11727, the
normalized_env
(calledupper_case_env
there) was generated fromself.env
, which held pairs where both the key and value were required to be valid UTF-8. In #11727,upper_case_env
started using all the keys that were valid UTF-8 (regardless of whether the value was also UTF-8), so in principle more keys might potentially be included.Since I noticed it here, I put back the check that both the env key and env var are valid UTF-8 before using the key in
normalized_env
. I don't really have a sense of whether this small change is important. If you think that it's probably not, then I'd be glad to use.keys()
instead, which I'd agree is more readable.