Skip to content

[bug] Input procsub body starts lazily at first read instead of at expansion (no true concurrency) #1583

Closed

Description

@caomengxuan666

Summary

An input process substitution body is not started when the expansion happens; it is materialized lazily at first consumption. GNU forks the body at expansion time so it runs concurrently with the main script. The body's side effects (and any interaction with the main script through other channels) therefore happen at the wrong time — or never, if the main script exits or blocks before first read.

Regression seed

cd "$(dirname "$0")"
rm -f started.flag done.flag
exec 3< <(touch started.flag; sleep 2; touch done.flag; echo late)
[[ -e started.flag ]] && echo "started=YES" || echo "started=NO"
[[ -e done.flag ]] && echo "done_at_exec=YES" || echo "done_at_exec=NO"
read -t 0.2 line <&3
echo "read1_rc=$?"
exec 3<&-

Measured (Linux, debug build of master ec279df tree vs self-compiled GNU bash 5.3.20)

  • GNU: started=YES (body already running concurrently), done_at_exec=NO, read times out.
  • rubash: started=NO (body not started until first consumption), read also times out (read-side timing is compensated by the timing judge — the divergence is the body's start time and true concurrency, not the read result).

Mechanism candidate (from the executor architecture audit)

Procsub payload endpoints are materialized lazily on first read instead of being spawned at the expansion point. Fix direction: eager start with a real child at expansion; existing procsub bookkeeping already tracks pid/status reaping.

Source: executor architecture audit (arch-audit B, candidate C4), probe p9c_procsub_live.sh, double-run on oracle and current build.

Activity

  1. added
    area:fd
    area:read
    bug
    gnu-baseline
    on Oct 26, 2026
  2. added a commit that references this issue on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:fdarea:readbuggnu-baseline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions