Repository navigation
fix(read): re-tag carrier bytes on the C-locale byte-domain write-back (Refs #3489) - #3547
Conversation
…k (Refs #3489) read_split.rs byte_domain_value emitted every byte < 0x80 as a bare char when it turned single-byte-locale fields back into storage text, undoing tag_read_carrier_text. Under LC_ALL=C (bats runs formatters under env -i) ESC stopped matching $'\e' patterns, so the junit formatter's xml_escape CSI strip left [0m/[K behind; 0x14 became `\`, 0x1f `$`, 0x11/0x13 vanished. The write-back now goes through bytes_to_shell_text, the storage-domain inverse of shell_text_to_raw_bytes, which re-forms UTF-8 and re-tags carriers. GNU: builtins/read.def:838-845 escapes CTLESC/CTLNUL and read.def:1127 / :1061 dequote_string undoes it, so the bound value is byte-identical to the input in every locale. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
master fmt drift from #3511 makes `cargo fmt --check` (the pre-commit hook and CI fmt) fail on every branch; formatting only, no test change. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Lead full-ledger review (2026-11-14)Fresh isolated Windows builds: base 83 suites measured on each side, 58 exact stdout comparisons on each. This is NOT 83/83 passing. After only exact worktree-root normalization, GNU stdout, Rubash stdout, and exit-code pairs are unchanged for all 83 suites between base and head. No newly observed stdout/exit-code regression in this run; no claim about whole-stderr equivalence. Limitations: Complete 83-suite stdout ledger and exit codes
Raw files are preserved in both Focused pin independently rerun: base 1 passed / 3 failed (rc 101), head 4 passed / 0 failed (rc 0), using exactly An earlier cargo attempt was blocked before test execution by a locked rubash.exe (os error 5); it is preserved separately and is NOT counted as fail-first evidence. Two proven-owned FIFO background-wrapper suite leftovers were inventoried and stopped before the successful pin runs. No user terminal or unrelated process was stopped. PR remains draft; no merge or issue closure is authorized by this ledger. |
…2847) (#3556) Fixes #2847 ## 修了什么 `scripts/check-api-ledger.py` 的 §6 校验从「子树里有同名声明」改为「记录的路径就是真实导出路径」: - `item rubash::a::b::Name`:从 `src/lib.rs` 起逐段解析,每一段必须是 `pub mod`(内联或文件,含 `#[path]`)或把模块 `pub use` 出来的再导出;末段 `Name` 必须在该模块**顶层**以 `pub` 声明(fn/struct/enum/trait/type/const/static/union/mod),或被该模块 `pub use` 再导出(具名、`as` 改名、glob;glob 目标可以是私有模块,如 `parser` 的 `pub use nodes::*`)。只认裸 `pub`,`pub(crate)` 不算对外面。 - `variant` / `method`:其所属类型路径按同一解析器校验(此前 method 完全不看类型路径)。 - 诊断区分两种失败:`declared in the tree but not exported under rubash::…`(路径错)与 `not found in tree`(符号没了)。 - 源码级近似:先抹掉注释与字符串/字符字面量,再按花括号深度判定「顶层」;不追宏生成的条目(真遇到会大声失败、需人工处理)。 - 自检(`--self-test`)新增一组:真实导出路径(具名/改名/私有模块 glob/`#[path]`/根再导出/子模块路径)必须过;未再导出、穿私有模块、类型路径错的 item/variant/method 必须各自失败。 ## 删了什么 `item_exists` 原先的「模块子树 rglob + 声明模式」判定(即 issue 所说的盲区)。`PUB_DECL_PATTERNS` 只保留用于失败诊断(区分「路径错」与「不存在」)。 ## 依据 工程面,无 GNU 锚。 ## 验证 - issue 复现:取 #2850 之前的树(`4f0d493c~1`,`CandidateKind` 尚未在 `src/api/mod.rs` 再导出): - 旧脚本:`all 279 ledger symbols present`,rc=0(假绿) - 新脚本:5 条失败(`item rubash::api::CandidateKind` + 4 个 variant,均为 `declared in the tree but not exported under rubash::api::CandidateKind`),rc=1 - 当前 master:`all 287 ledger symbols present`,rc=0;`--niu D:/repo/niubash`:287 present、97 consumed paths recorded,rc=0。 - `--self-test` rc=0(四段自检全部通过)。 - 运行时间与旧脚本持平(约 13.5s,瓶颈仍是原有的 method 全树扫描)。 - 另带一个仅格式化提交:`tests/d11_pipeline_squote_carrier_regressions.rs`(#3511 在 master 留下的 fmt 漂移,pre-commit hook 必红;与 #3531/#3547 中的同一 hunk 相同,合并无冲突)。 ## Owed - `docs/api-ledger.md` §5 第 1 条仍写「proves presence by declaration patterns only」,现已不准确;但该文件要求与 niubash 副本逐字节相同(canary `cmp`),需 rubash/niubash 成对改,本 PR 未动。 - 未在 CI(`niu-canary.yml` 的 `ledger` / `pairing` job)上实跑,仅本地 Windows Python 3 运行。 ## 队长复核(合入时) - 判词 PASS:L1–L8 一手跑过全绿(287/287、--self-test、复现树双向对照旧假绿 279 / 新 5 缺失、--niu 97 consumed、两份账本 sha256 identical)。 - CI run 43560449915:3 fail 逐名 = issue2875 ×2(goldens、macOS)+ issue2859 Linux-only;issue2859 按 #3292 类确认为 VOID(同头 macOS/goldens 该 cell 绿、零 Rust 产品代码、不碰 jobs/sleep 面)。 - 交集 ∅(merge-base 8b48c16 = live tip),无需 update-branch。 - 合入体:接受正文 Fixes #2847,#2847 随合入自动关闭。
|
【WIN-AGENT-AUDIT】 PR #3547 第1轮 — 建议:PASS 机制核查:
腿:
F 点:无 未跑/VOID 的腿:无(lib base 集复用同 merge-base 实跑结果;83 账本引用队长已留档证据)。 |
|
【WIN-AGENT-AUDIT】勘误(接上证):-D warnings 实际报错文件是 |
Refs #3489
修了什么
read内置在单字节 locale(LC_ALL=C;bats 在env -i下跑 formatter)的字节域回写把已打标的载体字节还原成裸字节入库:tag_read_carrier_text(read_helpers.rs)把 ASCII 载体字节(0x0c、0x11、0x13、0x14..=0x1f,含 ESC)打成 E000 标记对;标记对是非 ASCII,于是read_byte_domain(read_split.rs,[bug] C locale 下多字节 IFS 字符按整字符拆分(GNU 按字节拆分) #2819)在 C locale 下走字节域。byte_domain_value把每个 < 0x80 的字节当裸字符输出 → 标记被撤销,载体消费者随后吃掉这些字节:ESC 不再匹配$'\e'模式(junit formatter 的xml_escapeCSI 剥离循环失效,[0m/[K残留),0x14 变\,0x1f 变$,0x11/0x13 消失(formatter failure 体里^M\\''"\$stop` 的来源)。修法:
byte_domain_value改为bytes_to_shell_text(&shell_text_to_raw_bytes(text))——存储域的标准逆映射(UTF-8 重组、游离高字节保持标记、ASCII 载体重新打标,与tag_read_carrier_text/$'...'同一口径)。单变量、多变量拆分、read -a三条路共用此回写,一处修。删了什么
byte_domain_value的手写 UTF-8 首字节分类循环(33 行)——它是bytes_to_shell_text的不完整复刻(缺载体重标、缺标记区字符转义)。另:第二个提交只对
tests/d11_pipeline_squote_carrier_regressions.rs做 rustfmt(#3511 落地的格式漂移让 master 上cargo fmt --check失败,pre-commit hook 与 CI fmt 都会红;#3531 带了同样的改动,两边相同 hunk 合并无冲突)。GNU 依据
builtins/read.def:838-845:读入时对 CTLESC/CTLNUL 加 CTLESC 转义;read.def:1127(单变量)/read.def:1061(拆分字段)dequote_string撤销 → 绑定值与输入字节逐字节相同,与 locale 无关。字节值 0x1b 等不是 GNU 的 CTLESC/CTLNUL,本就不变。验证
GNU 5.3.20(WSL
/usr/local/bin/bash,脚本文件)对照:bats-format-junit(pre15-bats 副本)喂 GNU 生成的xml-escape.bats扩展 TAP 流,env -i、归一化 time/timestamp:修后 rubash 输出与 GNU 逐字节相同(含^Mstop</failure>与三处 CSI 剥离);修前即 issue 所述残留。tests/issue3489_read_byte_domain_carriers.rs(4 例,期望值取自 GNU 5.3.20 实测):issue2819_c_locale_multibyte_ifs9/9、issue277_read_carrier_domain_regressions7/7、issue2662_read_high_byte_delimiter12/12、issue1713_read_empty_ifs_regressions7/7、issue1716_read_last_var_delimiter_regressions5/5、issue1328_read_post_escape_count4/4、issue1419_read_nul1/1、a3_f3_read_ifs_backslash2/2、issue1635_carrier_pair_views_regressions0/0、issue1842_comsub_herestring_carrier_regressions0/0(这两个目标在 Windows 下 0 例)、cargo test --lib read_8/8。carrier_byte_class_regressions14/16:user_pua_data_roundtrips_verbatim、user_pua_length_counts_one_char两例在 未改动的 origin/master 上同样失败(与本改动无关,均不经过 read)。cargo fmt --check在 Windows 上因命令行超长(os error 206)无法运行;在 WSL 同树上cargo fmt --check干净(含 d11 格式化提交)。新发现(另立单,不在本 PR 范围)
[[ =~ ]]regex 操作数中的载体字节($'...'字面或|之后的${c})不匹配Owed
junit-formatter.bats在 rubash 下的端到端复跑(issue 口径:bats-core 52439ebf、env -i、逐文件)未做;本 PR 只验证了 formatter 阶段直跑与 GNU 逐字节一致。端到端复跑确认后可把Refs改为Fixes。