Skip to content

spawn hook: translate an in-image chdir: to its host twin (#152) - #153

Merged
ronaldtse merged 1 commit into
mainfrom
fix/152-spawn-chdir
Nov 8, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
fix/152-spawn-chdir

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Closes #152.

What

Both spawn hooks (POSIX + win32) translate an in-image chdir: option through the new tfs verb tebako_fs_exec_materialize_dir: a home-layout mount answers the whole-tree twin, any other mount extracts the subtree into the per-process dl tmpdir. Weak-externed — a runtime linked against an older link unit passes the chdir through untranslated (the pre-#152 honest ENOENT, no link break).

Why

The exec-target materialization alone is not enough: a spawn with an in-image chdir: dies in the child (ENOENT on the VFS path) before the materialized exe runs. The standing case is the 1.18.4 metanorma payload's render-time sass compile — sass-embedded's Open3.popen3(*Sass::CLI::COMMAND, '--embedded', chdir: __dir__) chdirs into the in-image lib/sass/compiler/. Exercised for the first time because isodoc 3.7.12 moved the style compile to render time, triggered by the strict font manifest read (metanorma#595) substituting a font and re-keying the scss font header. tebako-packages/metanorma#124's linux/windows legs die on exactly this; the macOS legs never recompile (the full ISO font set installs there).

The chain this rides

  1. tebako (tfs): the new verb tebako_fs_exec_materialize_dir + the c_api.h declaration + exports.txt — its own PR in the product queue.
  2. This patch (the chdir translation calling the verb).
  3. The source factory re-spin (a v* tag) → the runtime factory rebuild → the runtime line the metanorma payload pins.

Verification

  • The patch applies clean to the pristine ruby 4.0.7 process.c (git-apply-checked; the hunks are git-native regenerated, not hand-counted).
  • The tfs side's unit test (exec_materialize_dir_extracts_the_subtree_for_a_non_home_mount) proves the verb's contract: the subtree lands in the dl tmpdir once per process per path, a file answers ENOTDIR, an uncovered path ENOENT.
  • The compile-level proof (the sass spawn surviving) is the factory's CI on the rebuilt runtime — the patch needs the link unit carrying the verb, so the product release lands first.

@ronaldtse
ronaldtse force-pushed the fix/152-spawn-chdir branch from 38a7bb2 to 638e7b6 Compare November 8, 2026 15:00
A spawn carrying an embedded chdir: option died ENOENT in the child
before the materialized exec could run — the hook materialized the exec
target but the chdir passed through to a VFS path the kernel never
sees. The standing case: the 1.18.4 metanorma payload's render-time
sass compile (isodoc 3.7.12 moved the style compile to render; the
strict font manifest read's substitution re-keys the font header and
forces it), where sass-embedded's Open3 spawns the in-image dart with
chdir into the in-image lib/sass/compiler dir. tebako-packages/
metanorma#124's linux/windows legs die on exactly that (the macOS legs
never recompile — the full ISO font set installs there, so the shipped
css serves).

Both hooks (POSIX + win32) now rewrite eargp->chdir_dir through the NEW
tfs verb tebako_fs_exec_materialize_dir: a home-layout mount answers
the whole-tree twin; any other mount extracts the subtree into the
per-process dl tmpdir. The verb is weak-externed — a runtime linked
against a link unit predating it passes the chdir through untranslated
(the pre-#152 honest ENOENT). The tfs side is tebako's own PR (the verb
+ the c_api.h declaration + exports.txt). The patch applies clean to
ruby 4.0.7 (git-apply-checked); the regenerated hunks are git-native.
@ronaldtse
ronaldtse force-pushed the fix/152-spawn-chdir branch from 638e7b6 to fd8ec04 Compare November 8, 2026 15:00
@ronaldtse
ronaldtse merged commit c93c610 into main Nov 8, 2026
53 checks passed
ronaldtse pushed a commit that referenced this pull request Nov 11, 2026
…completion)

The #153 fix landed on the 4.0 series only — the 3.1/3.2/3.3/3.4 patches
never carried the chdir arm, so a 3.x runtime's spawn with chdir: into
the VFS still dies ENOENT (the metanorma 1.18.5 html-xml legs on ruby
3.3, tebako-runtime-ruby#333).

The arm is #153's own text verbatim (the weak-extern discipline
included); the regeneration is mechanical — the current patch applied to
the pristine upstream, the arm inserted, the diff regenerated — never a
hand-edited hunk. tools/apply proves each series on its latest version
(3.1.7 / 3.2.11 / 3.3.9 / 3.4.9), and each patched tree carries the verb.
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.

spawn hook: an in-image chdir option is not translated — the child dies ENOENT before the materialized exec runs

2 participants