Repository navigation
fix(expansion): preserve U+E316 in assignment concatenation (Refs #3016) - #3041
Merged
Merged
Conversation
preserve_prompt_escapes ended with a blind
`.replace(PROTECTED_PROMPT_ESCAPE, "\\")` that read the escaped
member of a user `E400 + E316` pair (typed `$'\uE316'`, E400-escaped
at entry by `push_literal_char`) as live protocol: it consumed the
E316 and left a stray E400, which the output decoder folded to a
backslash, so `w="a${v}b"` stored `a\b` instead of `a<E316>b`.
Restore E400-aware via `markers::restore_bare_sentinels`: a bare
guard (only one this function itself introduced for `\!` / `\#`)
maps back to `\`; an `E400 + E316` pair copies verbatim. Same family
as rubash#735 and rubash#840 divergence 3.
GNU anchor: subst.c:4309 expand_string_internal + variables.c
bind_variable (verbatim store); no guard folding at assignment.
Refs #3016
) 8 cells (LC_ALL=C.UTF-8 on the child): braced + unbraced assignment concat, direct-use control, plain/braced assignment controls, E316 + ` \!`, `\!` / `\#` guard preservation, E315/E317 neighbours, C0 control. Fail-first (transplant onto base 6eb861b): 5 passed / 3 failed — exactly the 3 predicted cells. Post-fix: 8 passed / 0 failed. Refs #3016
caomengxuan666
marked this pull request as ready for review
November 8, 2026 00:25
caomengxuan666
added a commit
that referenced
this pull request
Nov 8, 2026
…2885) - markers.rs census: add EXACT entry for __RUBASH_CURRENT_FILE (new carrier from #3035/#3047, missing from the E8 census). - marker_registry_roundtrips: remove all four TYPED_DATA_EXCEPTIONS (E002 shapes 1-3 fixed by #2882/#3006; E316 shape 3 by #3016/#3041); the stem now asserts every shape round-trips. - marker-lint-allowlist: delete the two #2882 KNOWN BLIND SPOT entries (their own text said delete when #2882 lands), plus two entries made stale by master-side changes: set.rs ESC rendering entry (#3044 restructured the table) and command_prepare contains:QUOTED_NULL_MARKER (#3006 converted those consumers to E400-aware helpers). - marker_leak_golden_pty: un-ignore the read -p cell (#3001 landed the read -p decode). - marker_leak_golden: set-listing C0 scalar cell now expects the ansic-quoted GNU form (rubash#3017/#3044), byte-verified against GNU bash 5.3.20; the no-marker assertion is unchanged. Verified on the merged tree (merge bd87ed1 + this commit): lint OK (117 consts / 258 sites), registry 10/0, PTY 2/0, golden 20/0, lib 1200/0/4, -D warnings rc=0, hygiene/fmt/CR clean.
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.
根因
preserve_prompt_escapes(src/executor/assignment_expansion.rs)末尾的盲.replace(PROTECTED_PROMPT_ESCAPE, "\\")把用户E400 + E316对中已被转义的成员当作 live protocol 读:吞掉 E316、留下一个孤儿 E400,输出解码器将其折成反斜杠。于是w="a${v}b"存成a\b,而 GNU 存a<E316>b。GNU 锚点:
subst.c:4309expand_string_internal+variables.cbind_variable(verbatim store,赋值处不做 guard 折叠)。同族先例:rubash#735 与 rubash#840 分歧 3。修法
单点:
preserve_prompt_escapes末尾改走markers::restore_bare_sentinels(E400-aware)——仅本函数自身为\!/\#引入的裸 E316 映回\;E400+E316用户对原样复制。两调用方(expand_assignment_value_inner、expand_quoted_prompt_arithmetic_assignment)同时受益。未动markers.rs/quotes.rs/continuation.rs/docs/api-ledger.md。测试
tests/issue3016_e316_assignment_concat_regressions.rs:8 单元。Fail-first(transplant 到 base):5 passed / 3 failed(恰为预测的 3 单元)。修后:8 passed / 0 failed。marker_leak_golden、issue735、issue824、issue1634、issue757、issue1099、assignment_quote_roundtrip、assignment_chain,合计 55 passed / 0 failed。6eb861b8)1197 passed / 0 failed / 4 ignored;失败名集合两边皆空,逐数对齐。RUSTFLAGS="-D warnings"cargo check:通过。cargo fmt --check(两触文件)+scripts/check-utf8-boundary-hygiene.sh:通过;两触文件 0 个 CR 字节。本 PR 删除了什么
什么也没删除。净行数 +183(修法
src/executor/assignment_expansion.rs+9/−1,净 +8;新钉tests/issue3016_e316_assignment_concat_regressions.rs+175)。Refs #3016