Skip to content

fix(fspy): bundle osh with the RunProcess getpgid ESRCH fix - #703

Open
lifeiscontent wants to merge 1 commit into
voidzero-dev:mainfrom
lifeiscontent:fix/bundled-osh-esrch
Open

fix(fspy): bundle osh with the RunProcess getpgid ESRCH fix#703
lifeiscontent wants to merge 1 commit into
voidzero-dev:mainfrom
lifeiscontent:fix/bundled-osh-esrch

Conversation

@lifeiscontent

Copy link
Copy Markdown

Motivation

Fixes #702.

Cached tasks on macOS run under the bundled osh (fspy substitutes it for /bin/sh, which as a platform binary can't load DYLD_INSERT_LIBRARIES). Stock oils 0.37.0 resolves the child's pgid with getpgid() right after fork, before waiting on it — and on macOS getpgid() of an already-exited child fails with ESRCH. The shell dies with oils I/O error (main): No such process, exit 2, empty stdout. Under CPU contention (parallel test runs) a few percent of spawns die this way.

Upstream fix: oils-for-unix/oils#2689 — the pgid feeds MaybeGiveTerminal(), which already no-ops when job control is disabled, so the `getpgid()) is gated on job control being enabled and batch shells never pay the race.

Changes

  • crates/fspy/build.rs downloads a 0.37.0 + patch build from https://github.com/lifeiscontent/oils-for-unix-build/releases/tag/oils-for-unix-0.37.0-fspy.1 (built by that repo's release workflow from the stock tarball plus patches/0001-run-process-esrch.patch, with build provenance attestations) until an upstream oils release carries the fix. If voidzero wants the binary under its own hosting, rebuilding from that repo's workflow and swapping the two URLs and hashes is the whole change.
  • crates/fspy/tests/oils_esrch.rs runs 200 tracked shells through fast external commands under contention; it fails against the stock binary and passes against the patched one.

Stock oils 0.37.0 calls getpgid(child) after fork even with job control
disabled, and on macOS getpgid of an already-exited child fails with
ESRCH, so a fast external command intermittently killed the substituted
shell with "oils I/O error (main): No such process" and exit 2 — a few
percent of runs under CPU contention.

Bundle a build of 0.37.0 plus the upstream fix (oils-for-unix/oils#2689,
gate the getpgid on job control being enabled) until an oils release
carries it. crates/fspy/tests/oils_esrch.rs pins the fix: it fails
against a stock binary and passes against the patched one.

Fixes voidzero-dev#702.
注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

项目

None yet

Development

Successfully merging this pull request may close these issues.

macOS: bundled oils shell intermittently fails fast external commands (getpgid ESRCH race)

1 participant