Skip to content

process_c_tebako_spawn: translate an in-image chdir target to its host twin - #154

Closed
ronaldtse wants to merge 1 commit into
mainfrom
spawn-chdir
Closed

ronaldtse wants to merge 1 commit into
mainfrom
spawn-chdir

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

What

tfs_spawn_prepare never translated the chdir: option: posix_spawn's
chdir is a file ACTION (invisible to the preload interpose) and the fork
path's chdir(2) runs where the mount points do not exist on the host, so
a spawn with chdir: into the VFS died ENOENT before the materialized
exec ran.

Reproduced minimally on v0.17.8 (macOS arm64): a payload image carrying a
native binary + a probe —
Open3.capture3("/pkg/native-true") passes;
Open3.capture3("/pkg/native-true", chdir: "/pkg") dies
Errno::ENOENT - /pkg. Full evidence in tebako-runtime-ruby#333.

The production bite: metanorma 1.18.5's html-xml check — isodoc
compiles SCSS through sass-embedded's
Open3.popen3(*CLI::COMMAND, "--embedded", chdir: __dir__), __dir__
being the in-image gem dir. tebako-packages/metanorma#124's CI fails the
check on all four macOS legs and both windows legs (Linux passes).

The fix

Both tfs_spawn_prepare variants (POSIX + windows) gain the arm, first
in the hook so shell and array forms both get it: a chdir_dir naming an
embedded path becomes its host twin through
tebako_fs_exec_materialize_dir — the link unit's export since v2.8.74
(the pinned v2.8.76 unit carries it: the header declares it and both
archives match). Parent-side, before fork — the hook's own
async-signal-safety discipline.

Completes #152: the subtree verb shipped when that issue
closed, but the hook never called it.

Verification

  • All five series regenerated mechanically (pristine upstream + the
    previous patch + the arm, diffed fresh — no hand-edited hunks) and
    apply through tools/apply on 3.1.7 / 3.2.11 / 3.3.9 / 3.4.9 / 4.0.7.
    (4.0.9 is not yet in versions.yml — the 4.0 series check rode 4.0.7.)
  • The patched tree carries both arms (exec_materialize_dir ×2).
  • The compile gate runs in CI (the factory's own rule); the runtime
    rebuild is the v0.17.9 line, then payload 1.18.5 + tools v2.8.75: the team's retarget on the current line tebako-packages/metanorma#124
    re-pins.

Draft until CI is green end to end.

…t twin

The spawn hook materializes the exec target but never translated the
chdir option: posix_spawn's chdir is a file ACTION the preload never
sees (and the fork path's chdir(2) runs where the mount points do not
exist on the host), so a spawn with chdir: into the VFS died ENOENT
before the materialized exec ran. sass-embedded's
Open3.popen3(..., chdir: __dir__) is the standing case — metanorma's
html-xml check dies there on v0.17.8 (tebako-runtime-ruby#333).

The arm rides tebako_fs_exec_materialize_dir (the link unit's export
since v2.8.74 — the pinned v2.8.76 unit carries it, header + archives
verified): an in-image chdir_dir becomes the subtree's host twin,
parent-side before the fork. Both platform variants carry it; the
regeneration is mechanical (pristine upstream + the previous patch +
the arm, diffed fresh — never a hand-edited hunk).

Completes #152: the verb shipped when it closed, the
hook never called it.
@ronaldtse

Copy link
Copy Markdown
Contributor Author

Superseded: #153 already landed the chdir translation on main (my local checkout was stale when I branched). The remaining gap is upstream consumption — tracking which source release carries it and what the runtime pins.

@ronaldtse ronaldtse closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants