8000 fix(minimald): exit 127 with command not found when an exec'd program is missing by gominimal-aw-bot[bot] · Pull Request #1929 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimald): exit 127 with command not found when an exec'd program is missing - #1929

Merged
norrietaylor merged 4 commits into
mainfrom
inbox-patch/fix/exec-missing-program-exit-127-7b355c00a04b0316
Oct 4, 2026
Merged

norrietaylor merged 4 commits into
mainfrom
inbox-patch/fix/exec-missing-program-exit-127-7b355c00a04b0316

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Oct 4, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABU3_lAA

A multi-word min session exec runs the program directly through the
nsenter shim. When the program is missing, the shim 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.

Verification

  • cargo fmt --all --check: clean
  • cargo build -p minimald --locked: clean
  • cargo test -p minimald --locked nsenter: 7 passed (includes the new
    spawn-failure mapping test)
  • cargo clippy: pre-existing failures in crates/args and
    session_host.rs from the toolchain mismatch (pinned 1.97.0 vs installed
    1.99.0); no warnings in the changed file
  • live-session: native-daemon-e2e — runs on this PR; not runnable in the
    fixer sandbox

Summary by CodeRabbit

  • Bug Fixes
    • Missing commands now exit with status 127 and display “command not found,” including when invoked with multiple arguments.
    • Permission-denied, non-executable, and invalid-format programs now exit with status 126.
    • Other launch failures remain errors. A missing or invalid configured working directory is not reported as a missing command.

… 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.
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner October 4, 2026 04:23
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Oct 4, 2026
@coderabbitai
coderabbitai Bot commented Oct 4, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

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
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 5a9f7e61-153c-47cf-a3cd-8e47b9470cb4
📥 Commits

Reviewing files that changed from the base of the PR and between 52e47b3 and 2e68974.

📒 Files selected for processing (1)
  • crates/minimald/src/nsenter.rs

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.


📝 Walkthrough

Walkthrough

The 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.

Changes

Spawn failure handling

Layer / File(s) Summary
Map and verify spawn failures
crates/minimald/src/nsenter.rs, scripts/session-e2e.sh
The shim maps ENOENT to 127 and EACCES or ENOEXEC to 126, with shell-style messages. A missing configured working directory and unrecognized errors remain NsenterError::Spawn. Unit tests check the mappings and missing-directory discriminator. The session proof checks the status and stderr for a missing command.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: norrietaylor

Merge Risk: ⚪ Minimal · up to 2e689

The spawn-failure change is mergeable after normal checks; no actionable issue remains in this review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: missing programs invoked through the exec shim now return shell-style exit code 127.
Description check ✅ Passed The description explains the problem and the intended behavior, and lists verification commands and results. It uses “Verification” instead of the template’s “Testing” heading and omits the checklist,…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the paths at night
“Not found” returns a code just right
The shell prints words for blocked commands
Tests trace the errors through the lands
Then hops away beneath the moonlight

Comment @coderabbitai help to get the list of available commands.

@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry
minimal-foundry Bot commented Oct 4, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at 2e689743db82.

Nothing to do.

Clobber: none: git log on both files shows only the four commits of this fix landing, no recent unrelated fix reverted.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Comment thread crates/minimald/src/nsenter.rs Resolved
…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".
@norrietaylor norrietaylor changed the title fix: minimald: exit 127 with command not found when an exec'd program is missing fix(minimald): exit 127 with command not found when an exec'd program is missing Oct 4, 2026
@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 4, 2026
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".
@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Comment thread crates/minimald/src/nsenter.rs Resolved
@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Oct 4, 2026
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch label Oct 4, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gominimal-aw-bot
Copy link
Copy Markdown
Contributor Author

Commit pushed: 2e68974

Generated by Worker iterate agent (side-repo-ops operator) · ⊞ 35.4K

@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 4, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 4, 2026
Merged via the queue into main with commit 99fe552 Oct 4, 2026
37 of 39 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/fix/exec-missing-program-exit-127-7b355c00a04b0316 branch October 4, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0