Skip to content

[P0][interactive] sourcing a file with eval + nested multi-line command substitution wedges the session (input echoes, never executes) — GNU sources fine #436

Closed

Description

@caomengxuan666

Found by the wt97b/hres ecosystem-harvest gold triage (fresh master build, niu 1.3.4 @ niubash master 04d7b7f). Real-world trigger: scop/bash-completion completions-fallback/nox.bash (the argcomplete fallback loader, 11 lines).

Symptom

In niu -i, source nox.bash (deterministic, 5+ reps): the prompt repaints, subsequently typed commands are echoed but never executed — the session is unrecoverable. niu file non-interactive runs the same file rc=0; rubash -n accepts (parse OK) — this is an interactive-pipeline bug, not a parser rejection. GNU bash sources the same file interactively and stays healthy (runtime rc=0).

Layer-2 symptom class of #425 (回显在、执行死), but with NO PROMPT_COMMAND/PS1 involvement — a different trigger proving #425's layer-2 concern (即使 ① 修了也要防其他 asset 触发).

Minimal repro (3 lines; deterministic 3/3)

eval -- "$(
    pathcmd=$(printf '' | command sed 's,x,y,')
    PATH=$pathcmd
)"
  • GNU bash 5.3.0 (WSL, file-arg): bash -n rc=0, runtime rc=0 (empty eval, clean exit)
  • rubash -n: rc=0
  • niu -i: source -> prompt repaints -> all later input echo-only

Ingredient matrix (each variant sourced in niu -i):

variant wedge?
eval -- "$( x=$(echo inner); echo "echo got-$x" )" (multi-line, nested comsub, non-empty) no
body line 2 = pathcmd=$(type -P bash ... | command sed ...) (type SUCCEEDS, non-empty) no
body line 2 without the | command sed pipe no
body line 2 = pathcmd=$(printf '' | command sed 's,x,y,') (EMPTY-output pipeline) YES
the wedging shape without redirects / without ${PATH:+...} / without [[ ]] YES

The poison combination is: multi-line eval -- "$( ... )" + nested $( ... | sed ... ) whose output is EMPTY + an assignment consuming it - after sourcing, the interactive execution pipeline is wedged. (Also wedging, each GNU-rt rc=0: the same shape with [[ $pathcmd ]] && PATH=...${PATH:+:$PATH} and/or type -P -- "$1" in line 2.)

GNU C source anchor

GNU evaluates the substitution body via subst.c:7143 command_substitute() -> parse_and_execute (parse.y:4451 parse_comsub for the body read); an empty pipeline result just yields an empty word, and eval -- "" is a no-op. Nothing in the GNU path leaves the interactive reader in a non-executing state.

Evidence paths

  • Repro: E:/eco-harvest/tmp/gold-sand/e1.bash (minimal), p3c-no-alt.bash, p3d-no-bracket.bash, original E:/eco-harvest/tmp/gold-sr/hang_nox.bash
  • Probe drivers: D:/eco-harvest/scratch/ps1-cont-probe.sh, gold-retest-wt97b.py (ConPTY harness)
  • Original gold row: D:/eco-harvest/results/test-results.jsonl hash 626d591d... (HANG, scop/bash-completion completions-fallback/nox.bash)

Activity

  1. added
    bug
    gnu-baseline
    on Oct 5, 2026
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