Repository navigation
fix(2881): add the LITERAL_CHAR_ESCAPE arm to the boundary decoder (Refs #2881) - #2911
Merged
Merged
Conversation
Fail-first pins for #2881 (PUA/carrier sweep F1, fix item E1). decode_raw_byte_markers_to_byte_chars — the decoder at the three external boundaries — has no LITERAL_CHAR_ESCAPE (U+E400) arm, so typed registry-zone chars reach real children as the escape pair where GNU bash hands over the raw bytes (execute_cmd.c shell_execve contract; sweep battery c08/c09 vs GNU 5.3.20). - unit: parity test asserting both raw-byte decoders agree on all registry inputs, plus the c08/c09 seed fold at decoder level - integration (tests/issue2881_boundary_decode_regressions.rs): c08 child-env, c09 child-argv and env-builtin shapes against real /usr/bin/env and /usr/bin/printf children UNVERIFIED-BY-CAPTAIN
decode_raw_byte_markers_to_byte_chars — the decoder at the three external boundaries (child argv, child env, env-builtin env) — had no LITERAL_CHAR_ESCAPE (U+E400) arm, so a typed registry-zone char reached real child processes as the U+E400 + char escape pair. GNU hands execve the raw word bytes (execute_cmd.c:6126 shell_execve), so the child must receive the raw char; the #2879 sweep byte-verified the leak against GNU bash 5.3.20 (cells c08/c09). Add the missing arm, mirroring the sibling decode_raw_byte_markers: E400 + c emits c verbatim; a trailing E400 stays E400. The fix is in the decoder's unit grammar, not at the call sites. Within the raw-byte decoder family this was the only missing arm (shell_text_to_raw_bytes, shell_text_prefix_for_raw_len and decode_raw_byte_markers all carry it). Fail-first evidence: the pins from the previous commits run red on the unfixed decoder (unit left = "\u{e400}\u{e314}"; child argv left = the pair bytes) and are re-run green with this commit. UNVERIFIED-BY-CAPTAIN
The parity pin's expected-decode helper built its byte-char domain text with `byte as char`, which trips the UTF-8 boundary hygiene gate (scripts/check-utf8-boundary-hygiene.sh) — CI's Rust tests job failed at that step before running any test. The widening itself is the decoder's documented contract (byte value == code point); char::from spells the same mapping explicitly and keeps the guard meaningful. Refs #2881
…ptain) 653e55f landed while the lane's baseline sweep had src/executor/substitution_metadata.rs checked out at the master version, so it silently reverted the fix arm, its doc comment, and both unit tests — only the integration stem survived. This commit restores all of them byte-for-byte from a277c03, with one intended delta: the parity pin's expected-decode helper now spells the byte-char widening as char::from(byte), which is the same mapping (byte value == code point, the decoder's documented contract) in the explicit form that does not trip scripts/check-utf8-boundary- hygiene.sh — the gate that failed CI's Rust tests job at the hygiene step before any test ran. Refs #2881
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 #2881 — lane delivery, CAPTAIN-VERIFIED 2026-11-06 (see verification section).
Fixes #2881
What
decode_raw_byte_markers_to_byte_chars(src/executor/substitution_metadata.rs) — the decoder used at the external boundary — handled only U+E000 raw-byte pairs and passedLITERAL_CHAR_ESCAPE(U+E400) pairs through untouched, so a value containing a typed registry-zone char (e.g.v=$'\uE314') reached real child processes as the U+E400 + char escape pair. Its siblingdecode_raw_byte_markershas the E400 arm. GNU hands execve the raw word bytes (execute_cmd.cshell_execve, cited in the decoder's own doc comment), so the child must receive the raw char — byte-verified against GNU bash 5.3.20 by the #2879 sweep (battery cells c08/c09).Fix: add the missing
LITERAL_CHAR_ESCAPEarm todecode_raw_byte_markers_to_byte_chars, mirroring the sibling (E400 + c → c verbatim; trailing E400 stays). The mechanism (the decoder's unit grammar) is fixed, not the call sites.Caller census (codegraph-first, rg cross-check)
callers decode_raw_byte_markers_to_byte_charson the master index (e8f1bb0) returns exactly 3, all external boundaries;rgoversrc/agrees (definition + 3 call sites):external_command_for_named_program_with_exec_name—src/executor/path.rs(child argv)apply_env_command_environment—src/executor/external_inner.rs(envbuiltin environment)child_env_value—src/executor/readonly_functions.rs(child env)Pins
src/executor/substitution_metadata.rstests):issue2881_raw_byte_decoders_agree_on_registry_inputs— one unit walk renders the expected decode in both output domains for every registry codepoint (MARKERS table), every raw-byte payload U+E001..=U+E100, and the edge shapes (trailing E400/E000, E000+E000, E400+E400, mixed);issue2881_byte_char_decoder_folds_typed_registry_char— the c08/c09 seed at decoder level.tests/issue2881_boundary_decode_regressions.rs, unix): c08 child-env shape, c09 child-argv shape, and theenv-builtin shape against real/usr/bin/env//usr/bin/printfchildren, with raw-C0 controls. The third call site (child_env_value) shares the same decoder and is covered by the unit parity pin.Fail-first (lane record, logs in the lane workdir): against the unfixed decoder the unit pins ran 0 passed / 2 failed and the integration stem 0 passed / 3 failed (child env carried the raw U+E400 pair; child argv bytes were the pair's UTF-8).
Captain verification (2026-11-06, head cf90157)
--lib issue2881: 2 passed / 0 failed.--test issue2881_boundary_decode_regressions: 3 passed / 0 failed.Process note (captain's own error, recorded)
The first CI generation failed the "Check UTF-8 boundary hygiene" step on a
byte as charwidening in the parity pin's TEST helper (production code was clean). The captain's hygiene fix commit (653e55f) was made while the lane's baseline sweep had the same file checked out at the master version, so the pushed head silently lost the fix + unit tests. Commit cf90157 reverts that commit (restoring the fix byte-for-byte) and re-applies the hygiene spelling (char::from(byte), with a comment recording that the widening is the decoder's documented byte-char contract). The final head's diff vs master is exactly the decoder arm + doc + pins (+255/−0, 2 files), read in full by the captain before pushing.本 PR 删除了什么
Nothing deleted. The change is one added match arm in the boundary decoder plus tests.
Net lines
+255 / −0 across 2 files (
src/executor/substitution_metadata.rs+119,tests/issue2881_boundary_decode_regressions.rs+136).