Repository navigation
WIP: jobs-small — coproc assignment-bang admission (#1983) + post-SIGINT first-line eat (#1997) - #2013
Merged
Conversation
…ection (rubash#1983) GNU's lexer returns an assignment-shaped first word as ASSIGNMENT_WORD, and parse.y:5899 reserved_word_acceptable has no ASSIGNMENT_WORD in its accept set, so a `!` after `coproc X=1` never becomes BANG — it lexes as a plain WORD and lands as the child command's name (GNU bash 5.3.20: the child reports `!: command not found`, script rc 0). The #1693 implementation of the #1652 rejection fired for every one-word collection, so the GNU-legal spaced shape `coproc X=1 ! echo hi` was rejected rc 2. Exempt assignment-shaped first words (name / name[subscript], optional `+`, then `=`), judged on the raw spelling — a quoted name is not an assignment word in GNU either. Non-name shapes (`9a=1`, `a-b=1`) stay WORDs and keep the rc-2 rejection. The word_metadata Vec gets an explicit element type: the exemption reads [0].raw before the first push, which leaves the element type ambiguous to inference (E0282). Judgment shape first measured in the #1712 line's 537e177. Regression pins: tests/issue1983_coproc_assignment_bang_regressions.rs (X=1 / a+=1 / _a9= spaced forms, a[1]=x subscript form, 9a=1 / a-b=1 negative controls, glued X=1! control). The pins assert the parse-admission face only; the coproc wait status after the output fd drains is a separate, pre-existing reap-face race (GNU deterministically reports 0 there) and is deliberately not pinned here.
caomengxuan666
force-pushed
the
fix/1997-1983-jobs-small
branch
from
October 29, 2026 04:18
828e2b7 to
198744e
Compare
…o (rubash#1997) The fg_sigint_unwind mark was flushed at the end of an input unit only when the unit ended Ok. When the unit ended in Err instead — the post-command boundary poll adjudicating the shell's own unconsumed SIGINT delivery into ExitCode(130) after the foreground wait had already set the mark — the mark survived into the next input unit, whose first boundary converted it: the next line was silently discarded without executing, and $? stayed 130 for the line after it. GNU consumes the interrupt in the list that was executing when it landed (jobs.c waitchld ADDINTERRUPT -> eval.c:111 reader DISCARD); it can never legitimately reach a line read afterwards. Captured live with an instrumented build (script(1)-grade PTY discipline via pty.fork, setsid child): WAIT-OK sig=Some(2) -> mark set -> in-unit boundary-poll Err sig=2 -> prompt -> the mark converting at the NEXT unit's list top, eating its line (1 of 220 traced cycles, load-dependent; a further eat in 1 of 40 cycles on the uninstrumented build; the android-signal cluster's probe7/probe.py captures match this symptom shape). The take is now unconditional (mem::take): on the Ok path the mark converts to SigintUnwind exactly as before; on the Err path the unit already ends with the interrupt's own verdict, so dropping the mark loses nothing. #1639's same-line discard is untouched — mid-unit marks still convert at the next command boundary of the same list, and its pins stay green. Regression pins: tests/issue1997_sigint_first_line_regressions.rs (setsid + group-delivery shapes, FIRST_130 -> SECOND_0 sequence required on every cycle). Post-fix PTY matrix on the same discipline: 160/160 cycles correct under strict classification.
caomengxuan666
force-pushed
the
fix/1997-1983-jobs-small
branch
from
October 29, 2026 04:26
198744e to
b41e656
Compare
caomengxuan666
marked this pull request as ready for review
October 29, 2026 04:39
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.
Two-issue jobs-small batch, one commit per issue. Draft; NOT to be merged by the author.
6f3b78f — #1983: coproc assignment first word exempts the index-1
!rejectionGNU's lexer returns an assignment-shaped first word as ASSIGNMENT_WORD, and parse.y:5899
reserved_word_acceptablehas no ASSIGNMENT_WORD in its accept set, so a!aftercoproc X=1never becomes BANG — it lexes as a plain WORD and lands as the child command's name (GNU bash 5.3.20 oracle: child reports!: command not found, script rc 0). The #1693 implementation of the #1652 rejection fired for every one-word collection, so the GNU-legal spaced shapecoproc X=1 ! echo hiwas wrongly rejected rc 2.Fix: exempt assignment-shaped first words (name / name[subscript], optional
+, then=), judged on the raw spelling (a quoted name is not an assignment word in GNU either). Non-name shapes (9a=1,a-b=1) stay WORDs and keep the rc-2 rejection. Judgment shape first measured in the #1712 line's 537e177. Includes the E0282-driven explicitVec<WordMetadata>annotation (the exemption reads[0].rawbefore the first push).Pins:
tests/issue1983_coproc_assignment_bang_regressions.rs(4 tests; parse-admission face only — the coproc wait status after the output fd drains is a separate pre-existing reap-face race, deliberately not pinned). Existing #1652 pins stay green (6/6 locally).Fixes #1983
198744e — #1997: flush the #1639 SIGINT unwind mark on Err unit ends too
The
fg_sigint_unwindmark was flushed at the end of an input unit only when the unit ended Ok. When the unit ended in Err — the post-command boundary poll adjudicating the shell's own unconsumed SIGINT delivery into ExitCode(130) after the foreground wait had already set the mark — the mark survived into the next unit and ate its first line (no execution, $? stuck at 130). Captured live with an instrumented build (WAIT-OK -> mark set -> in-unit boundary-poll Err -> prompt -> mark converting at the next unit's list top; 1/220 traced cycles plus 1/40 on the uninstrumented build, load-dependent). GNU consumes the interrupt in the executing list (jobs.c ADDINTERRUPT -> eval.c:111 DISCARD); it can never reach a later line.Fix: unconditional
mem::takeat the reader-level flush. Ok path converts to SigintUnwind as before; Err path already ends with the interrupt's own verdict. #1639's same-line discard untouched; its pins (7 + 3) stay green, as do #1662's 4 and #1825's 2 (local runs; one contention flake each for 1825-trapped / 1997-group during a parallel PTY matrix, both green on isolated re-runs).Pins:
tests/issue1997_sigint_first_line_regressions.rs(setsid + group-delivery shapes, FIRST_130 -> SECOND_0 required every cycle). Post-fix PTY matrix: 160/160 cycles correct under strict classification.Fixes #1997
Gate routing (2026-10-29 house rule)
cargo check --tests: this PR's CI.niubash builds against this treefails on the two repos'docs/api-ledger.mdcopy drift (byte 371) — also red on other branches today (fix/1903, fix/netopen-family, feat/s5); not this batch.