Skip to content

unquoted splitting in command-word position (for list / set -- / args) loses data carrier bytes: \x1c eaten as glue, \x1f folded to '$' #3103

Closed

Description

@caomengxuan666

现象

命令词位置的非引号展开(for 词表、set -- $v、命令参数的分裂消费路径)丢失数据载体字节:\x1c 被当作 IFS_GLUE 协议标记吞掉、\x1f 被折成 $。数组赋值路径(COMPREPLY 形)经 #3004 修复后正确,但命令词路径的展开 walker 在分裂之前就把标记对解码成裸字符,来源信息丢失,后续 char 域分裂器只能按协议读裸字符。

证据(基底 382cc8a;/usr/bin/printf | od 字节级转储,排除内建 printf 渲染面)

raw=$(printf 'x\034y\nz\037w')
k() { local IFS=$'\n'; for w in $1; do /usr/bin/printf '%s' "$w" | od -An -tx1; done; }
k "$raw"
# GNU:   78 1c 79   /  7a 1f 77
# rubash: 78 79      /  7a 24 77     (\x1c 丢失;\x1f 变成了 '$'=0x24)

m() { local IFS=$'\n'; set -- $1; ...; }   # 同形状同结果

GNU 锚点:subst.c:12377 word_split / list_string 对展开结果只按 IFS 字符分裂;展开结果中的数据 \x1c 是普通字符,\x1f 无任何特殊含义(DATA_DOLLAR 是 rubash 内部载体,用户 \x1f 字节必须以对编码进入传输、在消费边界解码,不得在 walker 中途按裸字符解码后又被载体解码器二次解释)。

与 #3004 的关系

#3004 车道发现并定界:本面在其修复前后行为不变(修复面为 arrays.rs 字节域分裂器与仿真内建入口,不碰命令词 walker),为既存缺陷。受影响形状是「捕获的文件名列表在命令词位置展开使用」:for f in $list、git add $files 等。

修法口径

  • 定点命令词展开 walker 在何处把对解码成裸字符(command_prepare.rs / command_words.rs / embedded_mutations.rs 一带),使分裂消费点拿到与数组路径相同的带来源文本,或使 char 域分裂器获得等价的来源判定——按机制二选一,须以 GNU 展开流水线(expand_word_internal 的 quoted/unquoted 区分)为据。
  • 不许逐形状打补丁(只修 for、不修 set --/参数位)。
  • 回归钉带本单号:for / set -- / 命令参数三形状 × \x1c-\x1f,基底 fail-first。

归宿

1.5.1 载体协议族后续波(#3004 同族),队长派工。证据原件:~/workspace/fix-3004/probe-ml2.sh 及 pml2-*.out。

Activity

  1. added this to the 1.5.1 milestone on Nov 8, 2026
  2. added
    bug
    gnu-baseline
    area:carrier
    on Nov 8, 2026
  3. caomengxuan666 commented on Nov 8, 2026

    @caomengxuan666
    MemberAuthor

    Closed by merged PR #3115 (squash merge f17644d7e1d56c1ec3e3edadc744b15e099ce095, Fixes #3103 in the merge body; API-verified CLOSED).

    Evidence (captain review, ~/workspace/review-3103/CAPTAIN-VERIFY.md, all legs PASS):

    • Fix: the byte-domain field splitter's re-encode now uses the canonical storage encoder substitution_metadata::bytes_to_shell_text (every carrier byte re-paired, marker-range chars E400-escaped — same shape as the storage entry). The local duplicate encoder in src/executor/arrays.rs that emitted <0x80 bytes bare (the provenance-loss point) is deleted; diff is that one file, +16/−33.
    • Pins 7/7 on head; fail-first transplant onto the true base gives exactly 2p/5f with the 5 red cells being the mechanism cells.
    • Lib bilateral 1206/0/4 on both trees with identical failing-name sets (the base's two timing-shaped reds — dap_pause_during_a_free_run, s4_step_into_loop_with_break_and_continue — passed isolated re-runs and are ruled load flakes).
    • Neighbours 8 stems / 81 cells all green; -D warnings, fmt, and the E7 marker lint all clean; GNU probes byte-SAME on three shape groups.
    • Residual correction: the lane's claimed remaining mirror panic (variable_state.rs:1095) does not survive the fix — it panics only on the base; on the head it is eliminated across the stage5/stages/m1/m2 shape groups with output byte-identical to GNU. It is therefore not carried as a residual; array mirror serialization panics/garbles multi-element assignments whose elements carry raw-byte pairs (\x1f proven) #3102's own shapes remain array mirror serialization panics/garbles multi-element assignments whose elements carry raw-byte pairs (\x1f proven) #3102's to prove.
    • New head 1e0452ab (after ready + update-branch) CI fully green: 10 pass + 1 skipping.
  4. added a commit that references this issue on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:carrierbuggnu-baseline

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions