Skip to content

[bug] Carrier leak: echo "\"$(echo "\\")\"" emits 0x18 (^X) control bytes around the backslash (GNU: "\\") #354

Closed

Description

@caomengxuan666

Found by gnusweep3 lane (cat1 q088; WSL GNU Bash 5.3.0 oracle, worktree 0fe8d0f). Carrier-family evidence cousin of #296/#179/#187/#214.

Repro:

echo "\"$(echo "\\")\""        # literal: echo "\""\\"""

GNU 5.3.0 stdout: "" (3 bytes: quote, backslash, quote)
rubash stdout: 0x18 0x5C 0x18 — a ^X control byte on each side of the backslash (carrier byte leaked into command OUTPUT; hex view in artifacts).

This is the nested-comsub-inside-dquotes escaped-backslash shape: the quoting state of the \ pair inside the inner comsub survives as a carrier that the final dequote fails to strip. Per the AGENTS.md worked counter-example, GNU keeps the \ in the token at split time and defers quote removal to the inner execution (parse.y:5366-5398 backslash branch + PST_NOEXPAND); rubash's carrier round-trip through the comsub is lossy here.

GNU C owner (mechanism that prevents it): subst.c:4807 dequote_string() / parse.y:5694-5706 got_character vs got_escaped_character — CTLESC carriers must never survive to output.
Artifacts: target/issue-suites/results/gnusweep3/cat1/case/q088.* (cat -A shows ^X^X); minimal target/issue-suites/results/gnusweep3/probes/min/m22-carrier-comsub.*

Activity

  1. added
    bug
    gnu-baseline
    on Sep 30, 2026
  2. added a commit that references this issue on Sep 30, 2026
  3. caomengxuan666 commented on Sep 30, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by wt20/deepsweep (21bb5345, master 2d9da6a): source-text quote carriers in expand_simple_substitution_fragments were owner-tagged as payload, so the E000 pair materialized to the raw byte at output. split_expanded_fragments now keeps carrier-family bytes of source fragments live (record_source_carrier_markers; materialize emits the ORIGINAL byte) plus quote-state tracking across literal fragments. Anchors parse.y:5694-5706, subst.c:11639-11673/4807. Carrier bar met: full 83-suite A/B (pristine vs fixed) LEDGERS IDENTICAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions