Repository navigation
fix(minimald): exit 127 with command not found when an exec'd program is missing - #1929
Conversation
… is missing A multi-word `min session exec` runs the program directly through the nsenter shim. When the program is missing, `shim_main` returned `NsenterError::Spawn`, which `main` printed as a debug value and exited 1, so a script could not tell "not found" from the command's own failure. Handle the spawn failure inside `shim_main`: print a plain message to stderr and return the shell's exit code (127 for ENOENT, 126 for EACCES, ENOEXEC and other spawn failures). Setns and Wait failures stay on the existing error path.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. 📝 WalkthroughWalkthroughThe shim maps selected program-start errors to shell-style exit codes and messages. A missing configured working directory and other unrecognized spawn errors remain errors. Unit tests and a session end-to-end check cover the mappings and missing-command output. ChangesSpawn failure handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The spawn-failure change is mergeable after normal checks; no actionable issue remains in this review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
A rabbit checks the paths at night Comment |
|
/review |
|
Approved: no findings at Nothing to do. Clobber: none: |
…port Only ENOENT, EACCES and ENOEXEC map to the shell's 127/126 exit codes. Any other spawn failure, such as the fork's ENOMEM when the session shell has exited, stays an NsenterError::Spawn so its cause is still named instead of reading as "cannot execute".
|
/review |
ErrorKind::PermissionDenied also covers EPERM, which a pre_exec hook (prctl, the capability drops, the seccomp load) can return; that is the shim's failure, not the program's, so EACCES is now matched by errno and EPERM stays a Spawn error. A missing --chdir directory fails the child's chdir with ENOENT too, so it no longer reports "command not found".
|
/review |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Commit pushed:
|
|
/review |
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABU3_lAA
A multi-word
min session execruns the program directly through thensenter shim. When the program is missing, the shim returned
NsenterError::Spawn, whichmainprinted as a debug value and exited 1,so a script could not tell "not found" from the command's own failure.
Handle the spawn failure inside
shim_main: print a plain message tostderr and return the shell's exit code (127 for ENOENT, 126 for EACCES,
ENOEXEC and other spawn failures). Setns and Wait failures stay on the
existing error path.
Verification
cargo fmt --all --check: cleancargo build -p minimald --locked: cleancargo test -p minimald --locked nsenter: 7 passed (includes the newspawn-failure mapping test)
cargo clippy: pre-existing failures incrates/argsandsession_host.rsfrom the toolchain mismatch (pinned 1.97.0 vs installed1.99.0); no warnings in the changed file
fixer sandbox
Summary by CodeRabbit