Repository navigation
perf(background): direct spawn for bare-external & bodies (four-commit series, three CR rounds) - #835
Merged
Merged
Conversation
…-free — failglob verdicts stay in the child (753.11) The gate expands the async command's words in the PARENT as an eligibility probe (background_direct_external_command -> expand_command_words); on failglob that probe (a) printed `no match` in the parent — the wrapper fallback's child re-reported it, doubling the diagnostic on the `&` line — and (b) armed the parent-side expansion latches (command_expansion_failed, evalerror_pending, evalerror_failglob_pending, exit_code=1), whose reader-level discard swallowed the rest of the launch line (`set -- /no/such/*.zzz & echo BG_after` lost its echo entirely). GNU expands the forked child's words inside the child: the parent never observes the verdict, the diagnostic prints once, and the launch line's remaining commands run. Fix: the probe runs under an expansion_probe_active flag — report_failglob stays silent while it is set — and the Err path restores the expansion latches and the pre-probe exit code before falling back to the wrapper, whose child reports exactly once. Attribution note: this is a master regression from the #809 train (28744c8 + CR rounds), reproduced on 5d51376 WITHOUT any #831 change; the bisect is 0d87020/e2fcb78f PASS -> c0005ff (rebase onto 5d51376) FAIL. It surfaced on this branch only because the rebase picked the regression up. The CR-round-2 collapse hypothesis does not hold — the failing shape is a background `&`, not `( (… ) )`, and the collapse flag is inert without a flat region. Tests: tests/regression.rs issue_753 suite 17/17 (case_11 included); failglob x collapse on/off battery (( (… ) ) collapsed, multi-command uncollapsed, f() ( ) flat, `&` gate, plain ( )) byte-identical with WSL GNU 5.3.0(1); issue720 17/17, issue797 8/8, goldens 74/74, audit harness 45 cases (same 4 known findings); ERR 14-form battery identical.
…sion scan (CI UTF-8 boundary hygiene)
parameter_expansion_assigns indexed the raw STRING with computed offsets
(&raw[cursor..]); the offsets were byte positions by construction (find
returns a byte offset, the walk advances over ASCII bytes only) but the
hygiene gate cannot prove it. Move all indexing onto the byte slice:
windows(2) over as_bytes() for the ${ marker (UTF-8 continuation bytes
are >= 0x80 so a two-byte ASCII window only matches at a boundary), and
starts_with on byte slices for the '=' / ':=' verdicts — no string
slicing left to justify.
Also close a multibyte hole the rewrite makes visible: a multibyte
character in the parameter-name position (${中文=…}) defeats the ASCII
identifier walk, so treat it conservatively and keep the wrapper (the
raw ':=' contains-check already covered the colon form; the multibyte
probe covers the colon-less one).
Multibyte regression (battery +3): ${中:=0.05} / ${中=0.05} keep the
wrapper (parent var not set), plain 中文 arguments ride the fast path —
byte-identical to base. Battery 44 probes; command_chaining 1517 passed
/ 9 pre-existing failures unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #809 (engine half). Four-commit series: direct spawn for bare-external
&bodies + CR round 1-3 fixes (restricted arm, raw-scan fallback for expansion-carrying shapes, fd≥3 forwarding, fatal-parameter pre-scan, failglob probe-flag silence) + failglob×background cross-probe. All CR-verified: three CR rounds with reproduction reversals, 40-probe battery, issue_753 17/17, command_chaining 1517 passed. $! = real worker pid (GNU-aligned). Windows wall unchanged (32-core masks); the 2.47x Android win lands via bionic fork-tax elimination — device re-test per the §7 checklist in the investigation report.