Skip to content

read builtin hangs forever on /dev/stdin #700

Closed

Description

@caomengxuan666

Summary

The read builtin hangs forever when reading from /dev/stdin. In CI / container entrypoints, read < /dev/stdin is a common idiom, so this is a hard hang, not a wrong value.

Environment: Niubash 1.4.0 · rubash git e785c3c8f610 — Windows 10 x64.
Method: differential vs GNU bash 5.2.21(1) / 5.3.0.

Repro

$ printf 'SIN\n' | niu -c 'read -r z < /dev/stdin; echo "got=[$z]"'
# niu: never returns — killed at 6s (rc 124)
# bash: got=[SIN]

Also hangs with stdin from a regular file:

$ { read -r z < /dev/stdin; echo "got=[$z]"; } < somefile
# niu: hangs
# bash: prints the line

Not the redirection itself

External commands on the same path are fine:

$ printf 'SIN\n' | head -1 < /dev/stdin
niu : SIN      # works

So /dev/stdin resolves for external children, but the read builtin blocks on it.

Severity

Hang with no output and no exit — matches this repo's P0-critical definition (卡死). Scripts that use read < /dev/stdin become permanently stuck under niu.

Activity

  1. added
    bug
    P0-critical
    on Oct 17, 2026
  2. caomengxuan666 commented on Oct 17, 2026

    @caomengxuan666
    MemberAuthor

    Version note (correction to the Method line): the oracle was reached with bare wsl.exe -e bash, which resolves through PATH to /usr/local/bin/bash = GNU bash 5.3.0(1) — not 5.2.21. The 5.2.21 build lives at /bin/bash, and every item in this report was re-checked on it as well; results were identical on both.

    So the two versions are listed in the wrong order above: 5.3.0 was the default, 5.2.21 the cross-check.

    No finding here changes; noting it only so the numbers reproduce. (Incidentally 5.3.0 is also the oracle cited in rubash#641, "the repository oracle is WSL 5.3.0".)

  3. added
    area:read
    area:fd
    on Oct 17, 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

    P0-criticalarea:fdarea:readbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions