Repository navigation
fix(main): -c operand marker-zone entry escaping — respawn exclusion is double-escape only (rubash#948) - #952
Conversation
CR(本轮不合并)阻塞:与 master 冲突,无法 squash。 解法明确:保留 master 的 issue-879 本地复验(全绿,附证据)按票面三项验收:
catalogue rebase 后 push 即可,语义面本轮已验全,无需重验。 |
…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>
2bd33dc to
49e25df
Compare
返工完成(rebase + CI)
语义面未动,仍以上轮本地复验证据为准。 |
终审:通过,合并rebase 返工验收四项全过(head
上轮遗留(父侧 argv 物化 mangling 裸 U+E000 词)照 PR 所写属独立根因、不在本边界内,维持 follow-up 建议。 Fixes #948 |
Summary
Fixes #948 — the
-cface's marker-zone decode residual. #947 fixed the stdin/script faces; the same typed literal still decoded on-cbecause the-coperand skipped entry escaping entirely.Root cause / decode-path difference.
run_command_string_with_initfed the raw argv operand straight to the drivers — no marker-zone entry escaping. Script files getbytes_to_script_text, stdin getsbytes_to_shell_text, both E400-escape literal zone chars at entry so decoders see them as data.-cgot nothing, sorubash -c 'echo "x<U+E319>41;y"'printedxAyandx<U+E000><U+E041>ymangled, while GNU prints both literally.Semantic boundary (成文, per ticket). The respawn exclusion documented in
substitution_metadata.rsis a double-escape exclusion, not an all--cexclusion:&/coproc children (RESPAWNED_CHILD—__RUBASH_SHELL_PID/__RUBASH_COPROC_CHILD, incl.__RUBASH_CMD_FILE) receive serialized AST already in transport spelling → skip entry escaping (unchanged).-cstring is fresh source like a script file → escaped by newsubstitution_metadata::command_string_entry_text.E400+zone pairs when it launches a plainrubash -cchild — transport spelling arrives without env markers. The escaping therefore preserves existingE400+zone pairs verbatim (idempotent within one text) instead of double-encoding them. A lone typedU+E400stays the documented ambiguous seam.Test plan
rubash -c 'echo "x<U+E319>41;y"'→x<U+E319>41;yverbatim (wasxAy), single- and double-quoted__RUBASH_CSB1_41;via-c→ verbatim__RUBASH_SHELL_PID+ transport text —E400+E319pair → literalE319, bare sentinel → protocol decode (no double-escape)-csanity (echo hi; $((x+1))) unchangedcases/issue-948.sh+ manifest row (must-match) — runs under arm green locally; runner requires WSL oracle, not executed herecargo test --lib substitution_metadata27/27Residual noted for follow-up: a literal
U+E000word emitted by a rubash parent into a spawned child's argv arrives mangled (E400+payload) — a parent-side argv materialize defect, separate root cause outside the-centry boundary. Recommend a follow-up issue.Generated with Devin