Repository navigation
fix(driver): keep the group's final physical newline for \<newline> collapse (Refs #3605) - #3673
Merged
caomengxuan666 merged 1 commit intoNov 16, 2026
Conversation
… collapse (Refs #3605) run-parser tail (parser1.sub): `eval "array=(foo bar)" ; echo AAA\\\<newline>\' printed `AAA\` where GNU prints `AAA`. GNU's reader sees the physical line's newline byte — parse.y:5379 read_token_word's `\` + peek `\\n` goes to `next_character` and the pair disappears; only `\\<EOF>` (no newline in the input) stays a literal backslash. The grouped reader's run_history_group rebuilt exec text by joining the group's stripped per-line texts, so the final line's real `\\n` never reached the re-parse: `\\<newline>` re-lexed as `\\<EOF>` and the backslash survived. Restore it — the group's pending span (raw lines verbatim) already records whether the last line carried its terminator, and a trailing newline after a complete command is an inert separator. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Member
Author
|
【WIN-AGENT-AUDIT】 机制核查:
腿(逐项给数字与名字):
F 点:无。 未跑/VOID 的腿:
|
This was referenced Nov 16, 2026
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.
Summary
run-parsertail (parser1.sub):eval "array=(foo bar)" ; echo AAA\<newline>printedAAA\where GNU printsAAA. GNU's reader sees the physical line's newline byte —parse.y:5379read_token_word's\+ peek\ngoes tonext_characterand the pair disappears; only\<EOF>(no newline in the input) stays a literal backslash.The grouped reader's
run_history_grouprebuilt exec text by joining the group's stripped per-line texts with\n, so the last line's real\nnever reached the re-parse:\<newline>re-lexed as\<EOF>and the backslash survived as literal. This restores the byte — the group'spendingspan (raw lines verbatim) already records whether the last line carried its terminator. For every other shape a trailing newline after a complete command is an inert separator, so the append is a no-op.Refs #3605 (class B, run-parser — clears the suite's only diff).
GNU anchors
parse.y:5379read_token_word—\+peek_char == '\n'->goto next_character(pair elided from the token).parse.y:5376shell_getc— the reader sees the real newline;\<EOF>takes the else arm and keeps the backslash (quoted).evalstring.cparse_and_execute— incremental reader; the same collapse applies on the final physical line.Verification (macOS arm64, GNU bash 5.3.20 oracle)
run-parser→ PASS (was the suite's only diff).rubash probe.sh= GNU byte-for-byte on:eval "true" ; echo AAA\<NL>->AAA;echo AAA\<EOF>->AAA\(literal, unchanged);eval-tagged multi-line group with heredoc/for-loop unchanged.tests/issue3605_grouped_trailing_continuation.rs(3 tests): grouped-driver collapse, fast-path parity,\<EOF>literal.run-aliasPASS,run-heredoc/run-trap/run-glob-bracketunchanged (their remaining diffs are owned by in-flight PRs fix(executor): scope in-process ${THIS_SH} child's exit-trap latch to the child (Refs #3605) #3670/fix(glob): export strmatch for loadables and route GLOBIGNORE through it (Refs #3605) #3630 on other branches).cargo fmt --checkclean; session_api / heredoc_delimiter_warning / issue414 regressions pass (only pre-existing macOS env flakes: TTY test,/varcanonicalization, BSD-vs-GNUodcolumns).Test plan
cargo test --test issue3605_grouped_trailing_continuationrun-parserPASScargo test --test session_api --test issue414_posix_reserved_word_alias_regressions --test issue1151_heredoc_delimiter_warning_regressions