Skip to content

set -u: unbound parameter inside a command substitution kills the whole script (GNU kills only the forked comsub child; script continues) #307

Closed

Description

@caomengxuan666

{"body": "Found by wt12/comsubfix (evidence in target/issue-suites/results/comsubfix/ m290probe.sh/m290probe2.sh, reproducible on master 6e8aebe): under set -u, an unbound parameter INSIDE a command substitution kills the whole script \u2014 GNU only kills the forked comsub child. Reproducer: set -u; echo A:$(echo x\); echo after \u2014 GNU prints the unbound diagnostic for the subshell, then "A:" and "after" with rc=0; we exit 1 at the first expansion and neither A: nor after appears. Generic (any unbound name). Suspected direction per the lane: the parent-level nounset_unbound_parameter scan enters the $( span (the Some(open-paren) arm skips only one character) \u2014 rubash#117 admission family interacting with the comsub fast path. GNU anchor: the unbound check fires inside the forked command_substitute child (subst.c:7143+), whose exit never propagates as a parent fatal."}

Activity

  1. added
    bug
    on Sep 29, 2026
  2. added a commit that references this issue on Sep 29, 2026
  3. caomengxuan666 commented on Sep 29, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by wt13/fixpack (191ab13, master d99124c): nounset_unbound_parameter paren arm skipped only ONE character after the open paren - the parent-level scan entered the comsub body (and the backtick body had no arm at all). Now the paren arm skips the whole balanced quote-aware span, a backtick span arm added, and dollar-double-paren explicitly keeps scanning (parent-level fatal semantics, expr.c expr_streval - probe-verified). GNU anchor: subst.c:7143 command_substitute does the nounset check inside the forked child. 15-form matrix byte-identical; comsub/comsub-eof/new-exp zero diff.

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