Repository navigation
Refs #2759, #2819 - #3123
Merged
Merged
Refs #2759, #2819#3123
Conversation
This was referenced Nov 9, 2026
… junctions (Refs #2759) The dollar_at segment assembly joined a quoted prefix/suffix onto an unquoted ${arr[@]} splice and split the joined string, splitting inside the quoted part (GNU subst.c:11229 expand_word_internal tracks quoting per character; subst.c:12273+ word splitting skips quoted separators). New pin file covers the filed shapes plus controls; also un-ignores the #2706-residual pin quoted_result_protection_at_array_junction, whose expectations were oracle-verified when filed.
) GNU subst.c string_extract_verbatim decides separator membership in the current locale: with MB_CUR_MAX == 1 (C/POSIX) membership is the per-byte ifs_cmap built by setifs, so a multibyte IFS character separates on each of its bytes; only a multibyte (UTF-8) locale matches whole characters via wcschr. Pins cover read (scalar and -a), ordinary word splitting, a three-byte IFS char, mixed byte+whitespace IFS, and the UTF-8-locale control.
…ed ${arr[@]} junctions (Refs #2759)
The dollar_at segmenter left a plain double-quoted span (and any
$"..." span) inside the surrounding unquoted literal run, so the run
was cooked and expanded as unquoted text and the junction field split
landed inside the quoted part — GNU expand_word_internal
(subst.c:11229) tracks the quoting of every character and word
splitting skips quoted separators. The segmenter now emits such a
span as a quoted literal segment — the same Literal{quoted: true}
carrier the quoted-body segmenter already used for in-body pieces —
flushing the pending run first; the segment expander IFS-protects a
quoted literal's whole expansion result. $"..." goes through the
same word-list attempts ("$@", "${name[@]}", embedded-$@ bodies)
as a plain quoted span; $$"..." stays the PID expansion plus a
plain span. Spans the literal pushers decline (backtick/backslash
content) keep the historic in-run path byte-for-byte.
…#2819) GNU subst.c string_extract_verbatim (subst.c:1148) decides separator membership in the current locale: whole characters via wcschr only when the locale is multibyte; with MB_CUR_MAX == 1 membership is the per-byte ifs_cmap setifs builds, so a multibyte IFS character separates on each of its bytes. field_split_values_with_ifs now routes non-multibyte-locale splits (past the locale-invariant unset/empty/default-whitespace branches) to a byte-domain twin that decodes value and IFS to bytes with glue provenance, tests membership per byte, mirrors the whitespace/mixed/non-whitespace field shapes, and re-encodes fields to storage text. read follows through read_split.rs: the scalar and non-raw -a value paths run the existing logical-unit walk on a byte-domain rewrite of line and IFS (every byte >= 0x80 becomes a raw-byte marker pair, so one logical unit is one byte) and normalize the produced values back. The raw -a path slices the caller's line by ranges and cannot represent mid-char byte boundaries; it is filed as a follow-up gated on PR #2968, whose live file table owns read_helpers.rs.
read_split.rs byte_domain_text widens *byte only under the if *byte < 0x80 guard directly above (>= 0x80 bytes route to encode_raw_byte_marker), so the widened byte is ASCII by construction. Record the review in the hygiene allowlist, same shape as the arithmetic/mod.rs guard-above precedent. No behavior change; check-utf8-boundary-hygiene.sh now clean on this tree.
caomengxuan666
force-pushed
the
fix/E6-wave1
branch
from
November 9, 2026 08:05
8544a38 to
9e229cf
Compare
caomengxuan666
marked this pull request as ready for review
November 9, 2026 11:06
This was referenced Nov 9, 2026
expansion: quoted-site IFS protection lost at unquoted ${arr[@]} junctions (residual of #2706)
#2759
Closed
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.
概要
180 单令第一波 · 组 E6(词分裂族两单):
${arr[@]}时,引号内的展开结果仍被分裂。根因是 dollar_at 段装配先拼成整串再分裂,抹掉了引号/非引号边界。修法在段模型层:顶层扫描器把普通双引号段(及$"...")发为 quoted 字面段——与引号体内段模型既有的Literal{quoted:true}同一机制——段展开器据此对该段展开结果做 IFS 保护(GNU subst.c:11229 expand_word_internal 逐字跟踪引号;subst.c:12273+ 分裂跳过被引字符)。string_extract_verbatim在 MB_CUR_MAX==1 时成员判定退化为 setifs 的逐字节 ifs_cmap;只有多字节 locale 才按整字符 wcschr 比对)。修法:field_split_values_with_ifs在非多字节 locale 走字节域分裂(值/IFS 解码为字节、逐字节成员判定、字段按存储编码回编);read的标量与read -a(非 -r)值级路径在 read_split.rs 内以同样的字节域语义运行(逻辑单元即字节)。本 PR 删除了什么
验证(返工后,新头 9e229cf)
9cbe0293(备份 refbackup/e6-pre-rebase-8544a38b);[bug] C locale 下多字节 IFS 字符按整字符拆分(GNU 按字节拆分) #2819 byte-domain 切分的编码调用按 fix(expansion): command-word field split keeps carrier-byte provenance (Refs #3103) #3115 的 provenance 模型改接 canonical 编码器substitution_metadata::bytes_to_shell_text,不复活已被 fix(expansion): command-word field split keeps carrier-byte provenance (Refs #3103) #3115 删除的私有三参 helper。cargo fmt --check、scripts/check-utf8-boundary-hygiene.sh、python3 scripts/check-marker-literals.py均 rc=0。unquoted_suffix_after_array_at_still_splits为对照格、基底与头同绿)、issue2819 8 格红(余 1 格 UTF-8 locale 对照格同绿);lib 双边同为 1206 passed / 0 failed / 4 ignored、失败名集同为空集;-D warningsrc=0;GNU 探针与旧头逐字节一致、对 GNU 分歧恰为已立案的 read -r -a 在单字节 locale 下字节域分裂丢空字段(#2819 残余) #3191/单引号 / ANSI-C 引号段在数组汇合后缀位丢尾随空格(#2759 残余) #3192 两面。REWORKED — captain re-verification pending
Refs #2759
Refs #2819