fix: resolve sudo via PATH in sudoif instead of hardcoded /usr/bin/sudo - #369
Open
kylerankin wants to merge 1 commit into
Open
kylerankin wants to merge 1 commit into
kylerankin wants to merge 1 commit into
Conversation
The sudoif privilege dispatcher probed for sudo anywhere on PATH with command -v sudo, but always invoked the hardcoded absolute path /usr/bin/sudo. On hosts where sudo lives elsewhere (/bin/sudo, /usr/local/bin/sudo, a Nix/Homebrew prefix, a toolbox/distrobox container) the guard passed and the invocation failed with 'No such file or directory', breaking sudo-clean, _rootful_load_image and every 'just sudoif' caller on non-FHS-standard hosts. Resolve sudo once into sudo_bin and invoke the resolved path. Add an explicit fail-closed message when sudo is unavailable and the caller is not root. Fixes projectbluefin#364 Signed-off-by: kylerankin <kylerankin@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #364
The
sudoifprivilege dispatcher probed for sudo anywhere on PATH withcommand -v sudo, but always invoked the hardcoded absolute path/usr/bin/sudo. On hosts where sudo lives elsewhere (/bin/sudo,/usr/local/bin/sudo, a Nix/Homebrew prefix, a toolbox/distroboxcontainer) the guard passed and the invocation failed with
"No such file or directory", breaking
sudo-clean,_rootful_load_imageand every
just sudoifcaller on non-FHS-standard hosts.Resolve sudo once into
sudo_binand invoke the resolved path, and add anexplicit fail-closed message when sudo is unavailable and the caller is
not root. The fail-closed branch is covered by
tests/unit/justfile-clean_test.bats(all 10 cases pass).
— hive: backend=pi model=lemonade/Ornith-1.5-35B-A3B-GGUF-Q6_K
🐝 Hive Agent:
contributor| SHA:baedaf0