( )⚙ D8347 encoding: use special dictionary type for env variables on Windows

This is an archive of the discontinued Mercurial Phabricator instance.

encoding: use special dictionary type for env variables on Windows
Needs RevisionPublic

Authored by indygreg on Mar 29 2020, 9:30 PM.

Details

Reviewers
marmoute
baymax
Group Reviewers
hg-reviewers
Summary

Environment variables on Windows are case insensitive and Python
internally uses a special dict type that normalizes all keys to
uppercase.

Our custom bytes-based environment variable dict on Windows was
not aware of this, leading to failures when looking up lower case
environment variables (such as http_proxy).

This commit introduces a custom dict type that normalizes keys
to uppercase on Windows. test-http-proxy.t passes after this
change, as a lookup of b'http_proxy' now succeeds.

It's worth noting that Python's behavior with regards to
normalizing all environment variables to uppercase is buggy.
See https://bugs.python.org/issue28824. I preserved Python's
behavior for compatibility.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

indygreg created this revision.Mar 29 2020, 9:30 PM
marmoute accepted this revision.Apr 17 2020, 2:31 PM
marmoute added a subscriber: marmoute.

Urg, this make me sad, but seems a reasonable way to move forward.

baymax requested changes to this revision.Jul 31 2020, 1:56 PM

There seems to have been no activities on this Diff for the past 3 Months.

By policy, we are automatically moving it out of the need-review state.

Please, move it back to need-review without hesitation if this diff should still be discussed.

:baymax:need-review-idle:

This revision now requires changes to proceed.Jul 31 2020, 1:56 PM