Skip to content

redirect-failure diagnostic bypasses ordered fd table on ()/simple faces; ! + compound + redirect failure inside a group aborts the script (residual of #826/#846) #940

Closed

Description

@caomengxuan666

Summary

Residual faces of the #826/#846 redirect-failure family, still diverging on master d4fc195c (2026-10-21). Two related symptoms:

R1 — the redirect-failure diagnostic bypasses the ordered fd table on non-brace faces: it goes to real stderr even when fd 2 was already redirected or silenced.

! ( :; ) 2>diag >./no_dir/f     # GNU: diagnostic lands in diag; arm: leaks to real stderr
! true    2>diag >./no_dir/f     # GNU: diagnostic lands in diag; arm: leaks to real stderr
{ : >./no_dir/f; echo ok; } 2>/dev/null
# GNU: silent, prints ok;  arm: diagnostic escapes to real stderr

(The 2>diag >bad ordering makes 2> succeed first so GNU's diagnostic lands in diag; on the arm it escapes to real stderr and diag stays empty.)

R2 — ! applied to a compound with a failing redirection, inside a brace group, aborts the whole script.

{ ! { :; } >./no_dir/f; echo "inner=$?"; }; echo "after=$?"
# GNU: diagnostic, inner=1, after=0
# arm: diagnostic, then NOTHING — script exits rc 1

The simple-command form is fine ({ ! true >bad; echo x; } continues), and the bare top-level ! { :; } >bad face of #846 is fixed — the abort only appears with ! + compound + redirect failure nested in a group context.

Likely the same single ruling point as #826's finish_brace_redirect_failure, which per #846's own analysis only covered the brace surface.

Pinned by

scripts/regression-catalog/cases/issue-846.sh (catalogue row diverges until the residual faces are fixed), added under #746.

Activity

  1. added
    bug
    on Oct 20, 2026
  2. added a commit that references this issue on Oct 21, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions