Repository navigation
deep-audit B6: diagnostic fidelity fixes (EOF form, times, caller, wait -n) - #2674
Merged
Merged
Conversation
…mes prefix, caller argument model, wait -n message) Four root-cause classes from the Round-2 Lane B6 differential sweep against GNU bash 5.3.20 (full report: deep-audit B6, 22 findings, 4 fixed here, 18 report-only). UNVERIFIED-BY-CAPTAIN. B6-F1: a dangling &&/|| at end of input got "syntax error near unexpected end of file" at the command's line (single command) or was silently EXECUTED (multi-command list). The and-or fold now stores the shared __RUBASH_PARSE_ERROR_EOF__ marker the pipeline fold already used (parse.y yyerror EOF form), discards the rest of the list, and the Session API gained the matching plain-EOF diagnostic arm. B6-F2: `times` hardcoded "rubash: " with no line segment; it was the one builtin whose diagnostic never received the shell diagnostic prefix (builtins/common.c builtin_error). Thread Executor::diagnostic_prefix() through execute_times -> times::execute_with_io, mirroring wait's plumbing. B6-F3: `caller` validated its argument before GNU's availability checks and with a Rust number grammar. Rewritten in caller.def's order: CHECK_HELPOPT (common.h:29) -> BASH_LINENO/BASH_SOURCE emptiness (silent 1; both arrays are empty at -c/-s top level) -> no_options scan (common.c:157; getopt names "-" + second char; a lone "-" and post-"--" words are operands) -> GNU valid_number grammar with sh_invalidnum's octal/hex variants (common.c:214). No FUNCNAME gate: caller.def:108 tests the raw array, which open_shell_script (shell.c:1636) keeps non-empty via an invisible "main" in script mode, so script-file top level validates. B6-F4: `wait -n` reported a non-job pid with wait_for_single_pid's "pid N is not a child of this shell" (jobs.c:2754). Under -n, GNU validates operands against the job table in set_waitlist (wait.def:352) and reports sh_badpid "`N': not a pid or valid job spec" (common.c:234). The -n flag is now threaded into both wait error sites; plain wait keeps the jobs.c text. Regression tests: tests/deep_audit_b6_diagnostics.rs (8 tests, one per fixed face family) + a times unit test. Verified via the build slot with scrubbed_cargo: B6 stem 8/8; guards issue519 (5), issue1118 (1), issue1156 (2), issue1064 parse-diag (8), issue1138 (1) all green; cargo check --all-targets clean; cargo fmt clean.
This was referenced Nov 3, 2026
caomengxuan666
marked this pull request as ready for review
November 3, 2026 17:35
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.
Deep-audit Round 2, Lane B6 (rubash diagnostic fidelity & exit-status fidelity). DRAFT — UNVERIFIED-BY-CAPTAIN.
Full lane report:
~/workspace/deep-audit/b6/REPORT.md— 22 findings: 4 fixed here, 18 report-only (byte-verified against GNU bash 5.3.20 throughout; error-class coverage matrix + NEEDS-OWNER-DECISION items in the report).Fixed in this PR (one commit, per-finding sections in the commit message):
&&/||at end of input: wrong "near unexpected end of file" form for single commands, and multi-command lists were silently executed. The and-or fold now uses the shared__RUBASH_PARSE_ERROR_EOF__marker (as the pipeline fold already did) and discards the list; Session API gained the matching diagnostic arm.timeshardcoded arubash:diagnostic prefix with noline N:segment; the shell diagnostic prefix is now threaded through from the executor (builtins/common.c builtin_error).callerargument model rewritten in caller.def's order: CHECK_HELPOPT → array-emptiness silence at-c/-stop level → no_options scan (getopt naming, lone-, post---operands) → GNU valid_number grammar with sh_invalidnum's octal/hex variants. (A caller.def:108 FUNCNAME gate was tried and reverted with evidence: GNU's gate tests the raw array, which carries an invisiblemainin script mode — pinned by a regression test.)wait -non a non-job pid now reports sh_badpid (`N': not a pid or valid job spec, wait.def set_waitlist) instead of wait_for_single_pid's "not a child" text; plainwaitunchanged.Verification (build slot, scrubbed cargo harness): new stem
deep_audit_b6_diagnostics8/8; guards issue519 (5), issue1118 (1), issue1156 (2), issue1064 parse-diag (8), issue1138 (1) all green;cargo check --all-targetsandcargo fmt --checkclean. 42-shape differential matrix for the fixed classes matches GNU except the two documented non-faces (B6-R17 multi-line EOF line;timesCPU-time values stub).Refs #2620