Skip to content

spawn plan apply: keep the plan's argv[0] — MRI does not re-prepend it (tebako#669) - #121

Merged
ronaldtse merged 1 commit into
mainfrom
fix/spawn-plan-apply-argv0
Sep 27, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
fix/spawn-plan-apply-argv0

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

What

tfs_spawn_plan_apply skipped the plan's first token, on the theory that ruby re-prepends command_abspath as the child's argv[0] at exec. It does not — the child argv comes from argv_buf verbatim. The first plan token (--tebako-image) was consumed as argv[0], its mount triple fell out of the flag parse, and the spawned runtime booted with only its env image: the /-mounted payload was unreachable (tebako#669's residual — Jing failed … Unable to access jarfile, argv-form spawn only; shell-form spawns were green on the same runtime).

Evidence

An argv-dump substituted for the spawned store exe shows the child's real argv as ["--tebako-image", "<triple>", "--tebako-entry", …] — the plan's tokens shifted by one. MRI's exec path takes the file from command_abspath and argv[0] from argv_buf's first token (exactly rb_exec_fillarg's layout — which the driver's plan already carries: [exe, --tebako-image …]).

Fix

Delete the apply-side skip; argv_buf keeps the plan's full argv. The extraction side (#119: offer only user arguments, never argv[0]) is correct and unchanged. All 8 carriers: neutral patches 3.1/3.2/3.3/3.4/4.0 + the 3.2/3.3/3.4 msys carriers (windows shell-form plans through the same function). The stale comment claiming the re-prepend is corrected in both the patch headers and the function block.

Verification

tools/apply green for 3.1.7 / 3.2.11 / 3.3.12 / 3.4.10 / 4.0.6, darwin + msys selections; applied process.c inspected — skip gone, comment correct. Compile-smoke gate runs in CI.

Companion product-side fix: tamatebako/tebako#673 (registry row split) + the driver regression test guarding the /-mounted-payload triple composition.

tfs_spawn_plan_apply skipped the plan's first token, believing ruby
re-prepends command_abspath as the child's argv[0] at exec. It does
not: the child argv comes from argv_buf verbatim, so the first real
token ("--tebako-image") was consumed as argv[0] and the actual first
mount triple fell out of the flag parse — the spawned runtime booted
with only its env image and the payload mounts were lost (tebako#669's
jing residual: Unable to access jarfile, argv-form spawn only).

Proven by an argv-dump of the spawned store exe: argv[0] was
"--tebako-image". MRI's execv takes the file from command_abspath and
argv[0] from argv_buf's first token — rb_exec_fillarg's exact layout,
which the plan already carries. Delete the skip; keep the full argv.
Applies to every line's neutral patch (3.1-4.0) and the 3.2/3.3/3.4
msys carriers (the windows shell-form surface plans through the same
function).

Verified: tools/apply green for 3.1.7/3.2.11/3.3.12/3.4.10/4.0.6 on
darwin and msys patch selections; applied process.c carries the full
argv and the corrected comment.
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