You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
modernish 套件启动期死于真实 use 加载上下文(harden.mm 级联误报,生态审计 DIV-F2) #2033
P2-medium中:次要缺陷或边缘路径,排期修复area:parserlexer/parser: heredoc collection, comsub body re-parse, quoting statebugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
The alias-live gather's streaming alias expander pre-pass — ComsubAliasScanner::drive in src/lexer/alias_stream.rs — had no # comment arm (and neither did its batch twin expand_comsub_alias_bodies). An apostrophe inside a comment (# sys/cmd/harden: modernish's replacement for 'set -e' ..., harden.mm line 4) opened a phantom single-quote string:
batch pre-pass: the quote skip swallowed the rest of the input, hiding real $(…) units from alias expansion (a latent second bug: aliases inside a comsub that follows an apostrophe-comment never expanded);
streaming pre-pass: the unterminated quote parked the phase across whole input spans (rescan_park + retry_deadline span throttle), so the gather's feeder/battery completeness machines were fed in bursts instead of per line. Their state diverged from the non-alias arm and the verdict wrongly blessed a mid-function group cut — harden.mm lines 4..276 of 404, cutting harden() mid-body. The cut chunk fails to parse standalone, surfacing at the \esac mode table (line 163; the non-monotone error lines across content cuts are just wherever the wrong cut lands).
This is why the trigger is exactly expand_aliases + ≥1 alias defined: without a live alias table the gather takes the raw arm, which gathers the same file correctly. It also explains why eval "$(cat t3.mm)" (whole-string batch parse) was clean while . t3.mm failed.
GNU anchor: parse.y:3631-3645 shell_getc — # at a shell_getc position ALWAYS comments ("Discard until EOL or EOF"); a mid-word # (echo a#b) never reaches shell_getc because read_token_word consumes word characters without returning to the character feeder. Probed on WSL GNU Bash 5.3: echo a#b → a#b; echo >#f → syntax error (# after > IS a comment); $( # hi ' there <NL> echo IN ) → IN.
Both pre-pass walkers get an at_word_start token-boundary state (true after input start / blank / newline / ; & | ( ) < >); # at a token start is skipped to EOL inert (no quote tracking). The streaming form parks only when the comment's newline is not yet fed, mirroring MainAliasScanner's own # arm. stream==batch preserved by construction.
Verification
tests/issue2033_alias_comsub_comment_park_regressions.rs (3 tests): the sourced-hardem-module frame and the comsub-after-comment pin both fail on the pre-fix binary, pass on the fixed build; mid-word a#b stays literal.
End-to-end: use sys/cmd/harden + type -t harden → function, rc=0 (full LF modernish clone @1d838eb); multi-module use + repeat-use smoke green.
alias_stream streaming-contract unit tests 7/7.
Comment-class GNU matrix (10 rows): byte-identical to GNU except two rows pre-existing identically on pristine (alias-value-with-comment, heredoc delimiter edge — separate gaps, unchanged by this fix).
true-baseline A/B, 19 suites (alias case casemod comsub comsub2 comsub-eof comsub-posix heredoc iquote nquote nquote1-5 quote quotearray redir vredir): fixed ledger == pristine ledger per suite — no regression.
Note: var/num/random still fails on both binaries (syntax error in the bin/modernish -c die-trap path) — pre-existing, separate from this issue.
P2-medium中:次要缺陷或边缘路径,排期修复area:parserlexer/parser: heredoc collection, comsub body re-parse, quoting statebugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Activity
caomengxuan666 commentedon Oct 29, 2026
Root cause (isolated + fixed)
The alias-live gather's streaming alias expander pre-pass —
ComsubAliasScanner::driveinsrc/lexer/alias_stream.rs— had no#comment arm (and neither did its batch twinexpand_comsub_alias_bodies). An apostrophe inside a comment (# sys/cmd/harden: modernish's replacement for 'set -e' ..., harden.mm line 4) opened a phantom single-quote string:$(…)units from alias expansion (a latent second bug: aliases inside a comsub that follows an apostrophe-comment never expanded);rescan_park+retry_deadlinespan throttle), so the gather's feeder/battery completeness machines were fed in bursts instead of per line. Their state diverged from the non-alias arm and the verdict wrongly blessed a mid-function group cut — harden.mm lines 4..276 of 404, cuttingharden()mid-body. The cut chunk fails to parse standalone, surfacing at the\esacmode table (line 163; the non-monotone error lines across content cuts are just wherever the wrong cut lands).This is why the trigger is exactly
expand_aliases+ ≥1 alias defined: without a live alias table the gather takes the raw arm, which gathers the same file correctly. It also explains whyeval "$(cat t3.mm)"(whole-string batch parse) was clean while. t3.mmfailed.GNU anchor:
parse.y:3631-3645 shell_getc—#at a shell_getc position ALWAYS comments ("Discard until EOL or EOF"); a mid-word#(echo a#b) never reaches shell_getc becauseread_token_wordconsumes word characters without returning to the character feeder. Probed on WSL GNU Bash 5.3:echo a#b→a#b;echo >#f→ syntax error (#after>IS a comment);$( # hi ' there <NL> echo IN )→IN.Fix (branch
fix/2033-modernish-use-2, commit 4e3d4d3)Both pre-pass walkers get an
at_word_starttoken-boundary state (true after input start / blank / newline /; & | ( ) < >);#at a token start is skipped to EOL inert (no quote tracking). The streaming form parks only when the comment's newline is not yet fed, mirroringMainAliasScanner's own#arm. stream==batch preserved by construction.Verification
tests/issue2033_alias_comsub_comment_park_regressions.rs(3 tests): the sourced-hardem-module frame and the comsub-after-comment pin both fail on the pre-fix binary, pass on the fixed build; mid-worda#bstays literal.use sys/cmd/harden+type -t harden→function, rc=0 (full LF modernish clone @1d838eb); multi-moduleuse+ repeat-usesmoke green.Note:
var/num/randomstill fails on both binaries (syntax error in thebin/modernish -cdie-trap path) — pre-existing, separate from this issue.fix(parser): alias pre-pass treats quotes in comsub comments/heredocs…
fix(parser): alias pre-pass treats quotes in comsub comments/heredocs…