Skip to content

Commit

Permalink
Basic: support case insensitivity for environment
Browse files Browse the repository at this point in the history
Windows is case insensitive for the environment control block, which we
did not honour. This causes issues when Swift is used with programs
which are incorrectly cased (e.g. emacs). Introduce an explicit wrapper
type for Windows to make the lookup case insensitive, canonicalising the
name to lowercase. This allows us to treat Path and PATH identically
(along with any other environment variable and case matching) which
respects the Windows behaviour. Additionally, migrate away from the
POSIX variants which do not handle the case properly to the Windows
version which does.

The introduced type `ProcessEnvironmentBlock` is just a typealias,
allowing access to the dictionary itself which is important to preserve
the behaviour for the clients.  The `CaseInsensitiveString` is a case
insensitive, case preserving string representation that allows us to
recreate the environment on Windows as the environment is case
insensitive, so it should not be possible to have conflicts when reading
the Process Environment Block from the Process Execution Block.

This is a partial resolution to environment variable handling as the
tools need subsequent changes to adopt the new API.

Fixes: #446
  • Loading branch information
compnerd committed Dec 18, 2023
1 parent 4e18164 commit b2ddcca
Show file tree
Hide file tree
Showing 2 changed files with 287 additions and 61 deletions.
Loading

0 comments on commit b2ddcca

Please sign in to comment.