Repository navigation
fix: convert blind QUOTED_NULL consumers to E400-aware helpers (Refs #2882) - #3006
Merged
Merged
Conversation
Fail-first: the new golden test fails on master (printf emits a stray U+E400, echo emits nothing, concatenation drops the char) while the 9 pre-existing golden tests pass. Expectations are GNU bash 5.3.20 bytes under LC_ALL=C.UTF-8, probe-verified per cell.
…2882) GNU protects a user CTLNUL with CTLESC at read time (parse.y got_character), so remove_quoted_nulls (subst.c:3181-3192) only ever strips the BARE marker; rubash's E400 literal-char escape is that protection's port, and a consumer of the registry-zone marker must not read the escaped pair as protocol. Convert the four blind read points to the #840 helper family: restore_bare_sentinels at the two walker-tail restore chains (command_prepare expand_quoted_single_name_parameter_word, embedded_mutations tail) and contains_bare_sentinel at the two alternate field-split gates. Typed $'\uE002' now round-trips: printf %s emits the raw char, echo emits it, concatenation keeps it; golden 10/10, full lib 1188/0/4.
This was referenced Nov 7, 2026
caomengxuan666
marked this pull request as ready for review
November 7, 2026 20:44
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 was referenced Nov 8, 2026
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.
Summary
Fixes the PUA/carrier-protocol sweep finding F2 (Refs #2882): a typed
$'\uE002'— U+E002 isQUOTED_NULL_MARKER— arrives E400-escaped(
push_literal_char) as user data, but blind consumers thatcow_replace/containsthe bare marker ate it:v=$'\uE002'; printf %s "$v"emitted a stray U+E400 alone (GNU: the raw U+E002 char)echo "$v"emitted nothing"a${v}b"producedab(char dropped)Storage was always fine (
declare -p,${#v}correct) — the consumerswere wrong.
Root cause
GNU protects a user CTLNUL byte with CTLESC at read time
(parse.y got_character, ~:5696), so dequote passes
(subst.c
remove_quoted_nulls, list_string QUOTED_NULL branchsubst.c:3181-3192) only ever strip the BARE marker. rubash's E400
literal-char escape is the port of that protection, so a consumer of a
registry-zone marker must distinguish the escaped pair (user data)
from the bare char (protocol). Three sites did not:
src/executor/command_prepare.rs(expand_quoted_single_name_parameter_word):walker-tail restore chain ended in a blind
cow_replace(QUOTED_NULL_MARKER_STR, "").src/executor/embedded_mutations.rs(
expand_embedded_parameters_mut_innertail): same blindcow_replacein the non-alternate branch.src/executor/command_prepare.rs(two alternate-word gates): naiveexpanded.contains(QUOTED_NULL_MARKER)deciding the quoted-nullfield-split route — the gate's question is "is the protocol
present", which is exactly
contains_bare_sentinel's contract.Sibling sites were already converted (#840):
conditional.rsandfield_split_values_with_quoted_nullsuserestore_bare_sentinels/contains_bare_sentinel.Fix
Convert all four blind read points to the E400-aware helper family in
src/executor/markers.rs—restore_bare_sentinels(bare marker →"", escaped pair copied verbatim) at the two restore chains, andcontains_bare_sentinelat the two gates. No new helpers, no newpublic surface,
docs/api-ledger.mduntouched,src/lexer/continuation.rsuntouched.Pins
tests/marker_leak_golden.rsgainsuser_e002_quoted_null_char_roundtrips_as_data: exact-byte cells forprintf/echo/concat (quoted, braced, unquoted, alternate quoted +
unquoted, assignment round-trip, double char, external argv) plus the
storage controls (
declare -p,${#v}). Fail-first on master:9 passed; 1 failed(the new test), probe-verified per cell againstGNU bash 5.3.20 under
LC_ALL=C.UTF-8.本 PR 删除了什么
Nothing is deleted. The change converts four blind call sites in
place to the existing E400-aware helpers and adds one golden test;
net line delta is small and positive (comments + test). No code,
tests, or docs are removed.
Residual face found during verification (not fixed here)
casepatterns whose double-quoted segment carries the char are asibling blind consumer: on the fixed tree
case "$v" in "$v")andcase "$v" in *"$v"*)are NOMATCH (GNU: MATCH), while the subjectside, the unquoted pattern form (
*$v*), and[[ "$v" == *"$v"* ]]all agree with GNU. Full probe table is in the lane REPORT §5 —
captain to file it separately or extend #2882 by ruling.
UNVERIFIED-BY-CAPTAIN