Skip to content

Pipeline stage-2 native exe gets argv with embedded double quotes stripped when stage-1 is a quoted-variable command with no redirections (function/if context) — rustup-init.sh check_help_for false-warns #205

Closed

Description

@caomengxuan666

Corpus: target-tools P1, real installer hit. Artifacts: target-tools/results/A-rustup/{gnu,rub}.out (rustup-init.sh from https://sh.rustup.rs, run with -y --dry-run), probes target-tools/results/P6..P13/.

Real-world symptom (rustup-init.sh line 773, check_help_for):

if "$_cmd" --help | grep -q '"--help all"'; then

Under GNU 5.3.0 (WSL): grep receives the pattern "--help all" intact, finds the string in curl --help output, no warning.
Under rubash (Windows, Git grep on PATH): grep: unknown option -- help all → check_help_for returns false → rustup prints TWO false warnings ("Not enforcing strong cipher suites for TLS", "Not enforcing TLS v1.2") that GNU never prints.

Deterministic minimal repro (P13/q1):

q1() { local c; c="$1"; if "$c" --help | grep -q '"--help all"'; then echo Y; else echo N; fi; }
q1 curl

GNU: Y. rubash: grep argv corruption error + N.

Trigger matrix (all rubash-side, P7-P13):

  • REQUIRED: stage-1 is a double-quoted VARIABLE command ("$c" --help) with NO redirection of its own, inside a function, inside an if condition.
  • Adding any redirection to stage-1 (2>/dev/null) → argv intact (k2, m7, h2).
  • Literal stage-1 (curl --help | ...) → intact (g3, h3, q2, q3).
  • Stage-2 = bash script (showargs.sh) → intact even in the failing shape (m5) — corruption is in the native-exe argv/command-line encoding path, not word splitting.
  • Pattern without a space ('"--help') → intact (q5); pattern without leading quote-dash → intact.
  • Top-level if + literal cmd → intact; positional "$1" as stage-1 with a redirect → intact (h4).

GNU spec: argv bytes must survive to the spawned program verbatim (execute_cmd.c execute_disk_command → shell_execve); no quoting layer may reinterpret argument contents. This is not an MSYS2-convention artifact: rubash itself passes the same pattern correctly in the sibling shapes above, so the failing path has its own encoder.

Classification: rubash-caused; found in real installer usage (rustup-init.sh is one of the most-executed installer snippets).

Activity

  1. added
    bug
    on Sep 27, 2026
  2. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    已修复并合入 master(commit f15bacd,lane wt/pipe)。根因:进程内管道段间用文本层 expand_word 重解析了已去引号的 argv 文本,吃掉了数据中的双引号字符;GNU 语义是管道各段从已解析的 WORD 结构展开一次、dequote_string 只剥 CTLESC(execute_cmd.c:2620 execute_pipeline + subst.c:4807),段间从不重解析。12 形态矩阵(顶层/if/函数 × 引号变量/字面 stage-1 × 有无重定向 × 原生/内建 stage-2,含真实 curl rustup 形态)与 WSL GNU Bash 5.3.0 字节一致,rustup-init.sh 的 check_help_for 不再误报。感谢报告!

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