-
Notifications
You must be signed in to change notification settings - Fork 5.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
modules.cmdmod: handle windows environ better #52472
Conversation
python exposes an nt.environ for case insensitive environment behavior that is native to windows; so it makes sense to use this instead of os.environ to avoid enexpected behavior and failure. further detail: https://bugs.python.org/issue28824
2018.3 backport #52472 modules.cmdmod: handle windows environ better
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 |
I also found If we go that route, we'll need to revert the PR that has been merged (#52476). |
@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. |
@mattp- OK. The environment returned by |
@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. |
2019.2 backport #52472 modules.cmdmod: handle windows environ better
@twangboy this should be good to merge I think ? thanks 👍 |
@Ch3LL yep closing thanks |
What does this PR do?
python exposes an nt.environ for case insensitive environment behavior
that is native to windows; so it makes sense to use this instead of
os.environ to avoid enexpected behavior and failure.
further detail: https://bugs.python.org/issue28824
What issues does this PR fix or reference?
environ handling on windows
Tests written?
Yes
Commits signed with GPG?
Yes/No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.