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
sudo: Prioritize sudo_as_root over HOMEBREW_SUDO_THROUGH_SUDO_USER. #16368
Conversation
This environment variable allows telling Homebrew to use the `SUDO_USER` variable to `sudo` through that user when Homebrew (Cask) attempts to run `sudo`. While we're here, clarify in some messaging that we're running `sudo` and that that's the password we're asking for; the specific password is configuration dependent and not the specific password for the user. Similarly, remove the `Package installers may write to any location` output; it's kinda spammy and doesn't feel like the right place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
This is not correct, sorry, I think you may have misunderstood what Homebrew::EnvConfig.sudo_through_sudo_user?
does.
Homebrew::EnvConfig.sudo_through_sudo_user?
means that if I'm a user that cannot sudo
to root
then it instead sudo
s to an intermediate user who then sudo
s to root
. This change would break that flow.
It may be that setting Homebrew::EnvConfig.sudo_through_sudo_user?
breaks what you intended with sudo_as_root?
and that the -u root
should be part of another if
rather than an elsif
but it's definitely not correct as-is, sorry.
Ah, indeed. I linked value of
In this case I think |
I can't really walk you through it all. It's possible because I use it daily 😉 |
…_USER." This reverts commit 907da26.
…USER System commands run with sudo_as_root must be run as regardless of who is running sudo.
Allow me to nitpick about the prompt: Is it too late to change the new env variable to something like
|
Updated the PR to add |
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Looks good in local testing, thanks again @Kentzo! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?sudo_as_root
is reserved for cases where a command must be run as root and root only. No other user can suffice regardless of group and/or ACLs. Therefore it should be preferred overHOMEBREW_SUDO_THROUGH_SUDO_USER
.