Skip to content

[bug] $(< missing-file) swallows the redirection error (GNU prints "No such file or directory") #196

Closed

Description

@caomengxuan666

Found by the suite2 ledger run (new-exp suite, new-exp2.sub:55), WSL GNU Bash 5.3.0 baseline.

Repro (LF script, both sides)

rm -f ./no-such-file-probe
LINES3=$(< ./no-such-file-probe)
echo "rc=$?"

GNU Bash 5.3.0

./no-such-file-probe: No such file or directory   (stderr, with "line 2:" prefix)
rc=1                                               (stdout)

rubash (target-wire/debug/rubash.exe, master 26728da)

rc=1

The failure exit status is correct, but the redirection diagnostic is completely missing (empty stderr).

GNU anchor

  • subst.c:7143 command_substitute() — the $(< file) short-circuit (redirection_setup failure reports via file_error/redirection_error before returning)
  • redir.c:298 redirection_expand() / do_redirection_internal error path that prints "No such file or directory"

Artifacts

  • probe: target-suite2/probes/p5-missing-diag.sh (+ .gnu.out/.gnu.err/.rb.out/.rb.err)
  • suite artifacts: target-suite2/results/new-exp/{gnu,rb}.err (GNU-only lines 6: "./new-exp2.sub: line 55: /tmp/redir-notthere: No such file or directory")

Activity

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

    @caomengxuan666
    MemberAuthor

    已修复并合入 master(commit 653b1de)。$(< file) 准入改用真实解析器判定(y.tab.c:7191 + evalstring.c:199),操作数按 redir.c:298 展开,打开失败报 errno 文本 + rc1(subst.c:7169);0 词/多词报 ambiguous redirect(redir.c:168);目录静默 rc0(EISDIR 语义)。24 探针矩阵 22 字节一致,余 2 个差异在非 comsub 的普通重定向行同样复现(通用重定向执行器缺口,另行跟进)。感谢报告!

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