Repository navigation
fix(executor): E400-aware sentinel decode family for marker output boundary - #947
Conversation
…undary (rubash#840) The three divergences share one root cause: registry-zone sentinels were restored by blind .replace() chains that read the escaped member of an E400 + c literal-char pair (typed `$'\uE3xx'`/`$'\uE0xx'` user data, push_literal_char) as live protocol. - Divergence 1: `a=($'\uE314Z')` stored the pair into the array mirror; declare -p printed a stray E400 prefix. fold_indexed_storage_dupes now decodes E400 + c -> c at the display boundary (cell/mirror transport parity preserved — the typed-read assert stays satisfied). - Divergence 2: user-literal `__RUBASH_CSB1_<hex>;` was re-decoded to its payload byte at printf/echo. The payload introducer moved off typeable ASCII to registry-zone U+E319 (COMSUB_PAYLOAD_SENTINEL) — bare sentinel is always protocol; typed lookalike passes verbatim. Decode is E400-aware. - Divergence 3: `v=$'\uE30D'`-class typed PUAs were eaten by the assignment-tail unescape (ASSIGN_EXPANSION_BACKSLASH et al.), leaving a dangling E400. Every registry-zone .replace() chain in the family now restores via restore_bare_sentinels (bare = protocol, pair = data). New markers.rs helpers: restore_bare_sentinels / decode_bare_sentinels (one-pass E400-aware rule sets), contains_bare_sentinel (admission gates), trim_bare_sentinel_suffix / ends_with_bare_sentinel (E302-wrap edge trims that read a pair member as a delimiter). Scanners (split_requoted_hoisted_compound_word, word_level_quote_syntax, split_indexed_tagged_token, StorageWordIter) copy E400 pairs verbatim. GNU subst.c:4807 dequote_string / strtrans.c ansic_quote contract: the rendered boundary restores user data; protocol is bare-only. Fixes #840 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… (rubash#840) Follow-up to 8f532b0: the comsub payload introducer moved off the typeable `__RUBASH_CSB1_<hex>;` ASCII form to registry-zone U+E319 (COMSUB_PAYLOAD_SENTINEL), but three test sites and several comments still encoded the old form. - command_prepare command_word_materialization_tests: the two argv- boundary asserts now feed the sentinel form; renamed materializes_legacy_payload_at_single_boundary accordingly and pinned the typed-ASCII lookalike passing verbatim (divergence 2). - substitution_metadata payload_protection_boundary test: the "existing token" input uses the sentinel form so it still exercises the contains_command_substitution_payload early exit. - issue824 regressions: the NOTE recording the (then out-of-scope) printf `%s` decode divergence is updated — fixed by this change — and a new end-to-end pin asserts typed `__RUBASH_CSB1_<hex>;` prints verbatim through printf/echo (GNU 5.3.0 prints it literally). - Stale comments naming `__RUBASH_CSB1_` as the live payload form in command_prepare.rs field-split, arrays.rs finalize_comsub_element and locale.rs decode tables now reference the U+E319 sentinel. Drive-by (test-only, pre-existing on the base): src/builtins/cd.rs's two #[cfg(windows)] tests still built HashMap::new() for execute_with_io after 4aaedfb (#916 follow-up) moved the parameter to &mut VarTable — `cargo test --lib` did not compile on Windows. The tests are cfg'd out on Linux/macOS CI, so the break was invisible there; VarTable derefs to the value map, bodies unchanged. No production-code change; test + comment updates only. Refs #840 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Follow-up commit 307e36c fixes the "Rust tests" CI failure: two Drive-by (test-only): CI: Rust tests / goldens / shell functionality / cross-target all green; Rust tests (macOS) queued on runner availability. Generated with Devin |
|
验证通过,实跑复核(本地 build @307e36c0,GNU 对照 = WSL bash 5.3.0(1) LC_ALL=C.UTF-8,两侧字节 cmp): 票面三分歧(stdin shell 面,逐字节一致 9/9 探针)
家族回归 34/34 绿(debug 构建):issue843(#853) 12、issue735 5、issue824 9(8 旧 + 新增 typed-CB1 pin)、marker_leak_golden 8。 引用链覆盖:command_prepare.rs(materialize 快路径改 contains_word_marker_bytes 门 + E400-aware restore;U+E319 带 0xEE 字节被快路径探针覆盖,核对过 markers.rs:448)、assignment_expansion.rs(restore_sq_content_markers、E302 尾 trim 全部 trim_bare_sentinel_suffix 化、decode_compound_expansion_carriers 六哨兵规则表)。全 src 扫描无剩余注册区盲 .replace(唯一命中是 conditional.rs:520 的生产侧 escape,正确保留)。 一个非阻塞残留(记档): 合并(--squash --admin)。 |
…is double-escape only (rubash#948) The -c face skipped entry escaping entirely, so a literal marker-zone char in a user-supplied command string (e.g. a typed U+E319 sentinel or U+E000 introducer) was read as live protocol and decoded into its payload char where GNU prints the literal glyph. stdin/script faces were already protected by bytes_to_script_text / bytes_to_shell_text (#856/#947). Semantic boundary, aligned with the #947 respawn comment: the exclusion is a DOUBLE-ESCAPE exclusion only, not an all-`-c` exclusion. Respawned `&`/coproc children (RESPAWNED_CHILD via __RUBASH_SHELL_PID / __RUBASH_COPROC_CHILD, incl. __RUBASH_CMD_FILE transport) receive serialized AST already in transport spelling and keep skipping entry escaping. Every other -c string is fresh source like a script file and is now escaped by new substitution_metadata::command_string_entry_text — which additionally preserves an existing E400+zone pair verbatim because a rubash parent's argv materialization emits pairs when it launches another rubash -c (plain spawned children, not only & respawns, can carry transport spelling). A lone typed U+E400 remains the documented ambiguous seam. Probes: rubash -c 'echo "x<U+E319>41;y"' -> x<U+E319>41;y (was xAy); typed A via -c verbatim; respawned-child transport spelling still decodes as protocol (no double-escape). Residual noted for follow-up: a parent-side argv materialize mangles a literal U+E000 word to bare E400+payload when spawning a child — separate root cause outside the -c entry boundary. Fixes #948 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…chanism at the U+E319 sentinel #947 retired the ASCII `__RUBASH_CSB1_<hex>;` payload spelling in favour of `U+E319<hex><hex>;` (COMSUB_PAYLOAD_SENTINEL, markers.rs). Resolution keeps the #729 extension and swaps only the spelling: - execution_misc.rs protect_command_substitution_output: extended byte set preserved (registered C0 markers 0x01/0x02/0x03/0x05 + 0x10..=0x1f), emitted as sentinel+hex+';' per #947's grammar. - conditional/pattern.rs: sides_need_byte_char_matching gates on COMSUB_PAYLOAD_SENTINEL (its 0xEE lead-byte probe already covered the E3xx plane); decode_payload_prefixes_to_pairs rewritten as decode_payload_sentinels_to_pairs with the same E400-aware grammar as execution_misc decode_command_substitution_payload. The four case_pattern_matches* entry points all use the wider gate (master's narrower either_side_needs_byte_char_matching removed; the '[' exclusion dropped — flattened_literal_backslash_marker_matches_backslash requires the gate to fire on '['-bearing patterns). - markers.rs: stale COMSUB_PAYLOAD_PREFIX MarkerInfo row deleted (the sentinel row already carries Output+Storage); the boundary-owner list and first-codepoint honesty table repointed to the sentinel names. - manifest.tsv: union — master's issue rows + the two carrier-729/735 rows (LF). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
Fixes #840 — three divergences in the "typed bytes reinterpreted at a render boundary" family, all one root cause: registry-zone sentinels were restored by blind
.replace()chains that read the escaped member of anE400 + cliteral-char pair (typed$'\uE3xx'/$'\uE0xx'user data viapush_literal_char) as live protocol.a=($'\uE314Z'); declare -p aprinted([0]="<E400><E314>Z").fold_indexed_storage_dupesnow resolvesE400 + c→cat the display boundary. The cell/mirror transport convention is untouched — cell still stores the pair, read-back still sees it — so the typed-readdebug_assertparity holds (decoding inquote_array_value/cell writers was tried and violates it).__RUBASH_CSB1_<hex>;was consumed into its payload byte. The comsub payload introducer moved off typeable ASCII to registry-zoneU+E319(COMSUB_PAYLOAD_SENTINEL): a bare sentinel is always protocol; the typed ASCII lookalike is now pure user data and passes verbatim.contains_command_substitution_payload/decode_command_substitution_payloadare E400-aware.a=($'\uE30D')-class words had the E30x member eaten, leaving a danglingE400. Every registry-zone.replace()chain in the family (assignment tail restores,decode_compound_expansion_carriers,unquote_storage_value,restore_quote_carriers,dequote_storage_marks,eval_source_for_reparse,split_indexed_tagged_token,quote_array_value, xtrace/conditional strips) now restores viarestore_bare_sentinels(bare = protocol, pair = data).New
markers.rshelpers:restore_bare_sentinels/decode_bare_sentinels(one-pass E400-aware rule sets),contains_bare_sentinel(admission gates — replaces.contains(E30x)misfires),trim_bare_sentinel_suffix/ends_with_bare_sentinel(E302-wrap edge trims that read a pair member as a delimiter). Char scanners (split_requoted_hoisted_compound_word,word_level_quote_syntax,split_indexed_tagged_token,StorageWordIter) copy E400 pairs verbatim.GNU contract: subst.c:4807
dequote_string/ strtrans.cansic_quote— the rendered boundary restores user data; protocol is bare-only.Test plan
issue824_marker_decode_boundary_regressions8/8marker_leak_golden8/8decode_to_visible_textpassa=($'\uE314Z')→[0]="<U+E314>Z";a+=( $'\uE30D' )→[1]="<U+E30D>";x='__RUBASH_CSB1_41;'→ verbatim at printf/echo/declare -p;v=$'\uE30D'→"<U+E30D>";arr=($'\uE30A'..$'\uE30F')→ raw charsdeclare -a d=($'\uE314Z'); echo ${d[0]}; d+=(x))cd.rstest-build error unrelated (HashMap vs VarTable API drift on base)Generated with Devin