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

Fix corner case where runas user's HOME env value is incorrect #47540

Merged
merged 1 commit into from May 8, 2018

Conversation

Projects
None yet
3 participants
@terminalmage
Member

terminalmage commented May 8, 2018

In the test suite, two of the failing pip.installed tests were failing because when we shelled out to get the user's environment, the HOME environment variable's value was incorrectly showing the root user's home dir.

This change ensures that we use the correct value for the HOME environment variable when running a command as another user.

Fix corner case where runas user's HOME env value is incorrect
In the test suite, two of the failing `pip.installed` tests were failing
because when we shelled out to get the user's environment, the `HOME`
environment variable's value was incorrectly showing the root user's
home dir.

This change ensures that we use the correct value for the HOME
environment variable when running a command as another user.
@terminalmage

This comment has been minimized.

Member

terminalmage commented May 8, 2018

As a bit of context here, this test failures seemed to have been related to the fact that the nonprivileged user created by the @with_system_user decorator was created immediately before we shelled out in cmdmod.py. The USER env var was not present in the results from shelling out, and the HOME env var was set to the root user's homedir. However, if I stopped the test using remote pudb and then shelled out via the python shell in pudb, both USER and HOME were present in the results, and had the correct values. So, this appears to be a bit of a race condition.

Note: We already had code in cmdmod.py to fix USER if it wasn't present, since it was not showing up when using runas in Solaris, so the fact that USER was missing when this test shelled out to get the environment was fixed by existing code.

@rallytime rallytime merged commit 291d3d3 into saltstack:2017.7 May 8, 2018

5 of 9 checks passed

jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #9701 — ABORTED
Details
default Build finished.
Details
jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #4750 — FAILURE
Details
jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #18805 — FAILURE
Details
WIP ready for review
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #24925 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #17044 — SUCCESS
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #22663 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #21664 — SUCCESS
Details

@terminalmage terminalmage deleted the terminalmage:cmdmod-home-fix branch May 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment