Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
modules.cmdmod: handle windows environ better #52472
What does this PR do?
python exposes an nt.environ for case insensitive environment behavior
further detail: https://bugs.python.org/issue28824
What issues does this PR fix or reference?
environ handling on windows
Commits signed with GPG?
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.
I'm not sure I'm understanding the intent here. Do you want it to be case-sensitive or not case-sensitive. Here are my results using
So, it looks to me like the dict returned by
would seem to indicate that you want a case-insensitive environment... which is not what I am getting with
@twangboy I think I may have worded that poorly. I'll describe what uncovered this: I am using salt to spawn chef-client converge (which in turn runs chocolatey installations). When spawning through cmd.run with os.environ being passed down to the popen, something was breaking with chocolatey that was making it think multiple versions of it were running/throwing 'chocolateyPending file in use' errors. In troubleshooting, I noticed a straight popen with no env being passed allowed things to work correctly, ie child proc is inheriting the parent env from salt. when cloning nt.environ, it still worked as expected, meaning that using nt.environ is equivalent to inheriting what is from the parent, but os.environ is not.
@twangboy https://github.com/python/cpython/blob/master/Lib/os.py#L729 I think is where the creation of os.environ comes from, which is all uppercase keys, first wins if multiple exist I guess.