fix: retry waitpid on EINTR; reap untracked children (stopped-job job-control loss) #20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/job-control-waitpid-eintr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A stopped foreground process group could escape job control when a signal such as SIGWINCH interrupted the blocking foreground wait. The shell treated the interrupted wait as a successful exit, so
jobsandfglost the process group even though it remained alive. Unreaped auxiliary children could also accumulate as zombies.Root cause
ffi_do_waitpidcalledwaitpidonce without retryingEINTR.wait-for-foreground-process-rawthen mapped the failed wait to an apparent exit.Changes
ffi-shim.c: retrywaitpidwhen it returnsEINTR.jobs.ss: reap terminated children withwaitpid(-1, WNOHANG), update tracked processes by PID, and continue polling stopped processes.mainand resolve the build/workflow conflicts.VERSIONfrom 0.5.0 to 0.5.1.Verification
make test: 691 jsh unit tests, 25 search UI tests, and 13 secure-history PTY checks passed.make binary: passed on macOS;jsh-macos -c "echo pr20-refresh-smoke"passed.make pre-pr-macos-linux-amd64-all: passed, producing the static strippedjsh-linux-amd64all-features binary.jobs.ssbalance and changed-line security checks passed.Forgejo CI is re-running against the refreshed branch.