Repository navigation
WIP: host signal family — REPL SIGINT discard classification, prompt $? and ^C echo (#610 #611 #600) - #615
Merged
Conversation
…not a session exit (niubash#610) A Ctrl-C that interrupts a pipeline in the REPL killed the whole session: the pipeline members die of SIGINT, the engine's boundary dispatch (rubash executor/trap_exec.rs, rubash#1662) converts the shell's own queued SIGINT into Err(ExitCode(130)) marked signal_discard_pending, and the host's ExitCode arms treated every unwind as a top-level exit jump — note_session_exit_jump consulted only take_parse_error. The REPL therefore ran end_repl_session(130): the EXIT trap fired and the process exited 130. GNU (verified against the 5.3.20 oracle, PTY matrix) returns to the prompt with $?=130, no EXIT trap, no diagnostic. The engine's own grouped driver (script_driver.rs) makes exactly this split; the host now mirrors it: - new note_exit_code_unwind: a discard-marked ExitCode arms no jump (parse flag still consumed so nothing stale leaks forward); - execute_script_inner's ExitCode arm applies the same check before setting script_exit_jump / the session jump; - ExecuteError::SigintUnwind (the rubash#1639 discard shape a single external produces) gets an explicit arm in both line-route matches and in execute_script_inner: $?=130, no "niubash: interrupt: discarding current command line" diagnostic, no jump — previously it fell into the catch-all, printing the diagnostic and returning 1. Regression pin (tests/interactive.rs, ConPTY lane): issue610_ctrl_c_pipeline_returns_to_prompt_with_130 — ping|findstr pipeline, Ctrl-C, prompt returns, st:130, EXIT-trap marker absent, discard diagnostic absent, session still alive.
At the prompt, reedline runs the tty in raw mode: the ^C byte never becomes a kernel SIGINT, no engine signal path runs, and the REPL's Signal::CtrlC arm just cleared the line — $? kept whatever the last command left (0 after any success). GNU leaves 130 (128+SIGINT) for a discarded prompt line (verified against the 5.3.20 oracle, PTY matrix prompt/half cells). The arm now sets the executor's last exit code to 130 before continuing; the next iteration's PROMPT_COMMAND pass reads that value and preserves it across the hook, as it does for any command status. Regression pin (tests/interactive.rs, ConPTY lane): issue611_ctrl_c_at_prompt_sets_status_130 — st:0 after `true`, Ctrl-C at the prompt, then st:130.
GNU shows a literal ^C at the point a prompt line is abandoned — the kernel's ECHOCTL echoes it while the tty is cooked, and readline echoes it in raw mode. Reedline (0.52) reports Signal::CtrlC without printing anything, and its raw mode means no kernel echo either, so niu showed nothing at all. The host now prints ^C at the head of the Signal::CtrlC arm, ahead of the existing newline: the on-screen shape is `<partial line>^C` then a fresh prompt, matching GNU for empty, mid-typed and continuation lines alike. The during-execution face of #600 needed no change: while a foreground job runs the tty is cooked, ECHOCTL is active, and the current master's PTY forensics show the ^C (the run2-era instability did not reproduce — see the cluster REPORT). Regression pin (tests/interactive.rs, ConPTY lane): issue600_ctrl_c_at_prompt_echoes_caret_c — Ctrl-C at an empty prompt, literal ^C in the transcript, session still alive.
…resh root Cargo.lock for stacker rubash #1836 added the stacker dependency; the refreshed lock adds the stacker subtree (stacker/psm/object/ar_archive_writer, additive only) so --locked builds pass against the new pin.
Member
Author
集成接棒证据(#610 / #611 / #600,基线 niu master 4e3e6b0)本 PR 已普通 merge 当前 niu master pin 与锁(配套动作)
合并树验收(重跑)
CI
说明:本评论为集成证据,PR 正文与关单词未动;未自合,待主会话合并。 |
This was referenced Oct 27, 2026
caomengxuan666
marked this pull request as ready for review
October 27, 2026 10:47
caomengxuan666
added a commit
that referenced
this pull request
Oct 27, 2026
Integration refresh riding the niubash#618 merge-up onto niubash master d7dcce5 (after #615). Rolls up rubash#1848 (unused-parens lint fix), rubash#1850 (#1807/#1832 exec seams), rubash#1855 (stacker target gating - unbreaks the aarch64-unknown-linux-ohos cross-target check) and rubash#1857 (#1852/#1854). Root Cargo.lock refreshed against the new pin and verified byte-identical (no dependency-set change in this range: #1855 only re-gates stacker by target expression); cargo check --workspace --locked rc=0 in the build slot.
caomengxuan666
added a commit
that referenced
this pull request
Oct 27, 2026
Integration of PR #617 onto niubash master d7dcce5 (after #615 landed): the pin moves from this branch's 0e9f8d45 to current rubash master 252ff19e (through rubash #1850/#1851/#1855/#1857, including the #1855 stacker target-gate that unbreaks the aarch64-unknown-linux-ohos cross-target check). Root Cargo.lock refresh was performed against the new pin's tree and verified a no-op (both merged branches had already refreshed the lock to identical content; the stacker cfg-gate does not change the lock's dependency representation) -- cargo check --workspace --locked passes in the build slot.
caomengxuan666
added a commit
that referenced
this pull request
Oct 27, 2026
* chore(pin): bump rubash pin to 0e9f8d45 and refresh root lock Rubash master 0e9f8d45 rolls up the issue-clearance wave-1 merges through rubash#1827 and rubash#1836; the latter's new stacker dependency (plus psm) enters the root Cargo.lock with this bump. * fix(history): keep the in-session list cleared after history -c (#614) -c emptied the reader, but the file deliberately keeps the cleared lines until the session-end write (#569) and reedline's sync/refresh merges the whole file back into the reader — so the first list query after any later append resurrected the entire pre-clear list. GNU lists only the post-clear lines. Apply the filed clear-generation/filter direction in the session ledger shared by the provider and editor instances: -c records the raw list length at clear time as a hidden prefix and bumps the view generation; list queries (search/count/load) apply the latest generation and answer from the suffix past the prefix, with ids re-based onto the view. An explicit re-read (-r/-n) or an authoritative replace ends the hide (GNU -r loads the file back on purpose; the bash-it -c && -r cycle depends on it), while the -a accounting rebuild keeps it. The file face and the #569 ledger/sync semantics are untouched: all internal flush/save paths still read the raw reader directly. Pins: three lib tests (resurrection grid over the twin instances, dual-session interleave, -r restoration) and a pty suite asserting the builtin's list through history > file redirects. * chore(pin): bump rubash pin to 252ff19e and refresh root lock Integration refresh riding the niubash#618 merge-up onto niubash master d7dcce5 (after #615). Rolls up rubash#1848 (unused-parens lint fix), rubash#1850 (#1807/#1832 exec seams), rubash#1855 (stacker target gating - unbreaks the aarch64-unknown-linux-ohos cross-target check) and rubash#1857 (#1852/#1854). Root Cargo.lock refreshed against the new pin and verified byte-identical (no dependency-set change in this range: #1855 only re-gates stacker by target expression); cargo check --workspace --locked rc=0 in the build slot. --------- Co-authored-by: 曹梦轩 <[email protected]>
This was referenced Oct 27, 2026
caomengxuan666
added a commit
that referenced
this pull request
Oct 27, 2026
…#617) * chore(pin): bump rubash pin to 0e9f8d45 (master through rubash#1827) Baseline refresh for the #603 branch. Rolls up the rubash clearance wave merged since 8fffc99e, including the stacker dependency rubash#1836 added for the #1801 stack-growth fix; the root Cargo.lock gains stacker/psm (and their object/ar_archive_writer deps) with this bump. * fix(startup): load the generated plugin loader for posix interactive shells (#603) run_startup_files' posix branch sourced $ENV and returned without ever loading the generated plugin loader, so posix interactive shells silently lost every plugin and theme in both login states — the #590 defect class on the one branch #590 could not reach. Per the product-semantics ruling on #603, the loader is niu's own activation plane, not a user file: posix mode governs the choice and order of user files (profile chain, then $ENV), not whether the product integration loads. The posix branch now loads the loader before $ENV, mirroring the ordinary branch's relative order — a login shell has just sourced the profile chain, so the loader lands after it (the #590 slot) and before $ENV; a non-login shell loads it at its rc face's seat, before $ENV, so $ENV lines win just as rc lines do. An exit inside the loader unwinds before $ENV and the login tail, like any startup file. No rc is sourced in posix mode, so the double-execution guard gets None, as on the login branch; the NIU_PLUGIN_LOADER=off switch and the validate gate still apply. Regression pins (tests/issue603_posix_loader.rs): the four-cell login/non-login x posix/ordinary matrix asserting loader effect and order via an ORDER sequence (PLE / LE / PL / LR), plus a login-posix loader-exit unwind pin. * docs(startup): declare the generated loader's posix behavior (#603) advanced-usage.md's startup section and getting-started.md's plugin section now state that POSIX interactive shells load the generated loader — after the profile chain and before $ENV for login shells, before $ENV otherwise — with $ENV in the rc's seat. * style(fmt): rustfmt the issue603 pin file * chore(pin): bump rubash pin to 252ff19e for the #617 integration Integration of PR #617 onto niubash master d7dcce5 (after #615 landed): the pin moves from this branch's 0e9f8d45 to current rubash master 252ff19e (through rubash #1850/#1851/#1855/#1857, including the #1855 stacker target-gate that unbreaks the aarch64-unknown-linux-ohos cross-target check). Root Cargo.lock refresh was performed against the new pin's tree and verified a no-op (both merged branches had already refreshed the lock to identical content; the stacker cfg-gate does not change the lock's dependency representation) -- cargo check --workspace --locked passes in the build slot. --------- Co-authored-by: 曹梦轩 <[email protected]>
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.
Host signal family (REPL SIGINT surface), one commit per issue:
signal_discard_pending, rubash#1662), and the engine's own grouped driver splits on exactly that mark; the host'sExitCodearms armed a session exit jump for every unwind. Host now mirrors the driver split in both the line route andexecute_script_inner, andSigintUnwind(rubash#1639) gets an explicit discard arm instead of the catch-all diagnostic + status 1.$?unchanged (GNU: 130). Reedline's raw mode swallows the byte, so the host now records 130 in theSignal::CtrlCarm, before the next PROMPT_COMMAND pass reads/preserves it.^C(reedline prints nothing in raw mode). The host echoes^Cahead of the newline, matching GNU's on-screen shape. The during-execution face was re-verified on current master (kernel ECHOCTL active while a foreground job runs); no change needed there.Acceptance: Linux tmux PTY matrix (single/burst × ext/loop/pipe/prompt/half + ^C forensics) against the GNU bash 5.3.20 oracle — see the cluster REPORT. Regression pins land in
tests/interactive.rs(ConPTY lane,NIU_INTERACTIVE_TESTS=1) in the same commit as each fix.Fixes #610
Fixes #611
Fixes #600