Skip to content

[bug] Single-quoted external arg inside $(): backslash dropped AND ${VAR} brace-stripped before exec - sed gets 'n' for '\n' and '$VAR' for '${VAR}' (hawaii50) #417

Closed

Description

@caomengxuan666

Found by wt53/themesweep (2026-10-03), hawaii50 theme load sweep (corpus abf8461, WSL GNU 5.3.0 oracle).

Minimal reproducer (script file, both shells)

out=$(printf 'You do not need one\nsecond line\n' | sed -e :a -e '$!N;s/\n/${SEP}/;ta')
  • GNU 5.3.0 (same sed semantics as Git GNU sed 4.9): pattern \n matches the newline; the single-quoted replacement ${SEP} stays literal -> lines joined with the literal text ${SEP}.
  • rubash 1.3.0: the letter n is substituted everywhere (o, seco) AND the replacement loses its braces (${SEP} -> $SEP) - i.e. rubash delivered the sed program with the backslash dropped and the braces stripped.

Observed from the sweep (hawaii50, no ip/ifconfig on Windows so the theme's error path runs):

  • GNU: IPs / clean text
  • rubash: You do$IP_SEPARATOR't have ifco$IP_SEPARATORfig or ip comma$IP_SEPARATORd i$IP_SEPARATORstalled!

Git Bash (same GNU sed 4.9 binary rubash resolves via PATH) executes the same line correctly, so this is rubash's argument delivery for single-quoted words inside $( ) pipelines, not sed.

Related: #301 (backslash dropped from single-quoted ALIAS body - same loss, different surface). GNU spec for literal single-quoted words: parse.y:5305 read_token_word(); here the comsub body split path is implicated (subst.c:1148 string_extract_verbatim / parse_comsub interplay).

Raw artifacts

  • Probe: target/issue-suites/results/themesweep/probes/hawaii50-sed.sh (+ h50-rb.out / h50-gnu.out)
  • Sweep: target/issue-suites/results/themesweep/omb-a/{out-rb2,out-gnu}/hawaii50.out
  • Verdict matrix: target/issue-suites/results/themesweep/omb-a/themes-A2.json
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions