Skip to content
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

runas from cmd.run in a state on mac doesn't use the correct PATH #53857

Open
bryceml opened this issue Jul 15, 2019 · 6 comments
Open

runas from cmd.run in a state on mac doesn't use the correct PATH #53857

bryceml opened this issue Jul 15, 2019 · 6 comments
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE MacOS pertains to the OS of fruit Phosphorus v3005.0 Release code name and version severity-high 2nd top severity, seen by most users, causes major problems

Comments

@bryceml
Copy link
Contributor

bryceml commented Jul 15, 2019

Description of Issue

on mac, using su -l does not use the login shell's path but changes it to /bin:/usr/bin

Salt uses something like:

su -l [user here] -c "[command here]"

to implement runas which means that when it runs the command, the path is set to /bin:/usr/bin which breaks a lot of things.

Steps to Reproduce Issue

run a state similar to

do_thing:
  cmd.run:
    - name: custom_thing
    - runas: my_user

where custom_thing is somewhere like /usr/local/bin/custom_thing

Possible solutions

We could do something like

sudo -u [user here] -i [command here]

under the hood on mac as that uses the correct path.

Versions Report

Salt Version:
Salt: 2018.3.4

Dependency Versions:
cffi: 1.11.2
cherrypy: 13.0.0
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 2.0.5
gitpython: 2.1.7
ioflo: Not Installed
Jinja2: 2.10
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: 2.18
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.14 (default, Feb 7 2019, 13:30:25)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 17.0.0
RAET: Not Installed
smmap: 2.0.5
timelib: 0.2.4
Tornado: 4.5.2
ZMQ: 4.1.6

System Versions:
dist:
locale: UTF-8
machine: x86_64
release: 17.7.0
system: Darwin
version: 10.13.6 x86_64

@bryceml
Copy link
Contributor Author

bryceml commented Jul 15, 2019

@Ch3LL said to ping @weswhet on this issue.

@bryceml
Copy link
Contributor Author

bryceml commented Jul 15, 2019

#43185

@bryceml
Copy link
Contributor Author

bryceml commented Jul 15, 2019

Maybe we should use sudo to get the correct path, then use su to switch user, and then set the path correctly, and then run the command. Although I don't know how well that would work with different shells.

@cmcmarrow cmcmarrow added Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged Bug broken, incorrect, or confusing behavior labels Jul 15, 2019
@cmcmarrow cmcmarrow added this to the Approved milestone Jul 15, 2019
@cmcmarrow cmcmarrow added the MacOS pertains to the OS of fruit label Jul 15, 2019
@bryceml
Copy link
Contributor Author

bryceml commented Jul 17, 2019

this issue appears to break rbenv.installed

@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 8, 2020
@waynew waynew added the Confirmed Salt engineer has confirmed bug/feature - often including a MCVE label Jan 8, 2020
@stale
Copy link

stale bot commented Jan 8, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 8, 2020
@sagetherage sagetherage added severity-high 2nd top severity, seen by most users, causes major problems Phosphorus v3005.0 Release code name and version and removed Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged labels Jun 16, 2021
@sagetherage sagetherage modified the milestones: Approved, Phosphorus Jun 16, 2021
@anilsil anilsil removed this from the Chlorine v3007.0 milestone May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE MacOS pertains to the OS of fruit Phosphorus v3005.0 Release code name and version severity-high 2nd top severity, seen by most users, causes major problems
Projects
None yet
Development

No branches or pull requests

7 participants