Environment variables on Windows are case insensitive. This means that if an environment variable is set via the openjd_env: key=value mechanism it would be expected that it overrides any existing environment variables regardless of casing. For example if there already existed an environment variable Test=test and OpenJD finds openjd_env: TEST=test2, it would be expected that only TEST=test2 would be found in the environment.
Current Behaviour
If there already exists an environment variable, say Test=test, and OpenJD finds openjd_env: TEST=test2. Two environment variables with the same name, but with different casing, will be stored. When queried Windows will choose the first one that was written, in this case it would use the value test instead of test2 as expected.
Reproduction Steps
Set an environment variable to something with lower case letters in the key, like set Test=test. Then print out that same environment in all caps like python -c "print('openjd_env: TEST=test2')". Next call set, observe that both environment variables are present when only one should be.
Expected Behaviour
Environment variables on Windows are case insensitive. This means that if an environment variable is set via the
openjd_env: key=value
mechanism it would be expected that it overrides any existing environment variables regardless of casing. For example if there already existed an environment variableTest=test
and OpenJD findsopenjd_env: TEST=test2
, it would be expected that onlyTEST=test2
would be found in the environment.Current Behaviour
If there already exists an environment variable, say
Test=test
, and OpenJD findsopenjd_env: TEST=test2
. Two environment variables with the same name, but with different casing, will be stored. When queried Windows will choose the first one that was written, in this case it would use the valuetest
instead oftest2
as expected.Reproduction Steps
Set an environment variable to something with lower case letters in the key, like
set Test=test
. Then print out that same environment in all caps likepython -c "print('openjd_env: TEST=test2')"
. Next callset
, observe that both environment variables are present when only one should be.Code Snippet
Seems to be related to these lines https://github.com/OpenJobDescription/openjd-sessions-for-python/blob/mainline/src/openjd/sessions/_session.py#L138 and https://github.com/OpenJobDescription/openjd-sessions-for-python/blob/mainline/src/openjd/sessions/_win32/_popen_as_user.py#L152
The keys here should be all changed to uppercase to avoid case conflicting issues.