You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
core(exec): use libc signals + cfg(target_family="unix"); robust SIGSYS gating; fix sandbox detection; correct macOS test
- Replace hardcoded signal numbers with libc on Unix:
- SIGINT/SIGABRT/SIGBUS/SIGFPE/SIGKILL/SIGSEGV/SIGPIPE/SIGTERM/SIGSYS now come from libc.
- Grouped under a unix_sig module and re-exported; eliminates repeated per-line cfgs.
- Keep non‑Unix fallback SIGKILL_CODE=9 for synthesized 128+9 behavior.
- Gate platform logic cleanly:
- Use cfg(target_family = "unix") around Unix-only paths.
- All SIGSYS uses now compile on every Unix, avoiding previous linux/macos-only symbol gaps.
- Tests updated to gate the SIGSYS codepath on target_family = "unix".
- Improve sandbox classification:
- Prefer stderr hints first: treat “sandbox: deny”, “seccomp”, and common OS errors (“operation not permitted”, “permission denied”, “read-only file system”) as LikelySandbox.
- Defer SIGSYS handling only when a sandbox was requested; otherwise treat non-timeout signals as immediate errors.
- Shell-style SIGSYS exit (128 + SIGSYS) recognized on all Unix targets.
- Formatting/truncation remains centralized:
- No changes to output shaping other than classifying sandbox denials earlier so user-facing messages are consistent (“failed in sandbox: …”).
- Tests:
- Correct an especially egregious path typo in macOS seatbelt exec test:
- core/tests/suite/exec.rs: "/user/bin/touch" → "/usr/bin/touch".
- This was likely a typo; if it was intentional for a specific scenario, we can reintroduce it behind an explicit comment/cfg. As‑is it prevented the test from exercising the intended read‑only denial
and instead looked like a missing-binary edge case.
- Misc:
- Ran just fmt and just fix -p codex-core; clippy autofixed exec.rs (9 fixes).
- Verified codex-core builds; project tests run, with unrelated existing failures unchanged.
Rationale
- Avoids Windows/*BSD build breaks from SIGSYS references while keeping behavior correct on Linux/macOS.
- libc keeps signal numbers portable; grouping reduces cfg noise and maintenance risk.
- Earlier stderr-based sandbox detection makes the shell tool denial UX match expectations even when the sandbox blocks before the child produces long output.
0 commit comments