Skip to content

fix: resolve sudo via PATH in sudoif instead of hardcoded /usr/bin/sudo - #369

Open
kylerankin wants to merge 1 commit into
projectbluefin:mainfrom
kylerankin:fix-sudoif-path
Open

kylerankin wants to merge 1 commit into
projectbluefin:mainfrom
kylerankin:fix-sudoif-path

Conversation

@kylerankin

Copy link
Copy Markdown

Fixes #364

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, and add an
explicit 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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] Justfile sudoif probes PATH for sudo but invokes hardcoded /usr/bin/sudo

1 participant