Repository navigation
fix(builtins): set listing ansic-quotes marker-carried C0 scalars via shared byte-stream ports (Refs #3017) - #3044
Merged
Conversation
…C0 scalars Fail-first on base 578999f: 4 passed / 4 failed. Covers the marker-carried C0 block (FF/FS/GS/RS/US/ESC/DC1/US), bare declare and typeset, raw high byte 0x80, ansic-branch priority over the metas and quote-data branches, the already-correct controls, and the POSIX-mode raw-bytes wart GNU itself ships.
…am ports print_shell_variables' private shell_quote judged ansic_shouldquote at char level (ch.is_control()), but part of the C0 range and raw high bytes ride in storage as U+E000 raw-byte marker pairs, which read as printable PUA to a char scan — those values fell through to the single-quote/bare branches and printed raw bytes. GNU print_var_value (variables.c:1126-1148) tests the raw byte stream (strtrans.c:341 ansic_shouldquote / :230 ansic_quote); the executor already carries faithful ports that decode the marker pairs first, and the declare/array faces use them. Route the set face through the same pair and delete the private char-level copies. Refs #3017
caomengxuan666
marked this pull request as ready for review
November 8, 2026 01:01
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.
caomengxuan666
added a commit
that referenced
this pull request
Nov 8, 2026
…d-consumer lint, registry census (Refs #2885) (#3015) Marker-leak enforcement gates for rubash#2885 (PUA/carrier protocol audit, rubash#2879): E6 per-channel golden coverage, E7 blind-consumer lint with allowlist, E8 registry census + typed round-trip stem. Captain verification (branch head `1c4a1383`, true base `b4eaed55`, plus captain merge-time reconciliation `22852ec4` on merged master): - golden 18/0 on the branch head; registry 10/0; PTY 1 passed / 1 ignored (the read -p cell, un-ignored at merge time — 2/0 after). - E6 pristine-tree adjudication: at the E6 commit the golden stem is 14/4 — the lane's original "18/0" was a stale-binary measurement. - lib head 1198/0/4 vs base 1196/0/4 (+2 decoder tests moved into lib, 0 failed both sides). - lint OK (117 consts / 262 sites); planted-violation fail-first rc=1; lint against base sources reports 103 violations (the gates bite); E7 value audit rc=0. - `RUSTFLAGS="-D warnings"` rc=0; hygiene clean; fmt clean; CR zero. - Merged tree (after merging master and the reconciliation 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. - Merge-time reconciliation: census gained the EXACT entry for `__RUBASH_CURRENT_FILE` (#3035's carrier); all four registry exceptions removed (E002 via #2882, E316 via #3016); the two #2882 KNOWN BLIND SPOT allowlist entries deleted, plus two entries made stale by master-side changes (#3044 set.rs table, #3006 command_prepare conversion); one golden cell's expectation updated to GNU's ansic-quoted set-listing form (#3017/#3044), byte-verified against GNU bash 5.3.20. 本 PR 删除了什么: the branch removes the superseded in-lib marker test module (its coverage moved into the golden/registry stems) and obsolete allowlist scaffolding; the captain reconciliation commit additionally deletes the four registry exceptions and four allowlist entries listed above. Net across the PR: +2156/−289 before reconciliation, +10/−21 for the reconciliation commit. Refs #2885
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.
Refs #3017(UNVERIFIED-BY-CAPTAIN — 队长复核前不合入)
根因
set与裸declare/typeset共用的列举面print_shell_variables(src/builtins/set.rs)对标量用文件私有的shell_quote渲染,其 ansic 判定是 char 级的(ch.is_control())。rubash 存储里 C0 段的一部分(FF、DC1、ESC、FS/GS/RS/US 等)与原始高字节以 U+E000 原始字节 marker 对形态携带,对 char 级扫描读作可打印 PUA,于是这些值掉进单引号/裸印分支、把裸字节直接吐到终端。仓库已有忠实移植executor::ansic_shouldquote/ansic_quote(判定前先解 marker 对、按字节流判定),declare 族与数组面早已在用——只有 set 渲染面留了一份看不见 marker 的私有复刻。GNU 锚点
variables.c:1096print_assignment以quote=1调print_var_value。variables.c:1126-1148print_var_value:quote && !posixly_correct && ansic_shouldquote(value)→$'…';否则 metas → 单引号;否则裸印。POSIX 模式 GNU 本身裸印控制字节(wart,本 PR 保持并钉住)。lib/sh/strtrans.c:341ansic_shouldquote对原始字节流逐字节 ISPRINT;strtrans.c:230ansic_quote命名转义 + 三位八进制。修法
shell_quote的 ansic 分支改调共享判定/渲染对(crate::executor::ansic_shouldquote/ansic_quote),删除两份私有复刻。metas→单引号、裸印两分支与 POSIX 闸门不动;数组面(declare 的value_is_printable_ascii)本就正确,未动。本 PR 删除了什么
src/builtins/set.rs中两份私有复刻函数:char 级ansic_shouldquote与ansic_quote_value(合计 −36/+10 于该文件)。净行数:全 PR 见文件清单(钉文件 +147 行为新增测试;全 PR 净 +157/−36)。证据(车道自报)
tests/issue3017_set_listing_ansic_quote_regressions.rs(8 例):fail-first 4 passed / 4 failed;修后 8 passed / 0 failed。RUSTFLAGS="-D warnings" cargo check --locked --lib --bins过;hygiene clean;改动两文件 rustfmt --check 过。