Skip to content

[bug] Process substitution path form is a Windows temp file, not /dev/fd/N: 'case <(echo c) in /dev/fd/*' fails (GNU: matches) #355

Closed

Description

@caomengxuan666

Found by gnusweep3 lane (cat3 p011/p022; WSL GNU Bash 5.3.0 oracle, worktree 0fe8d0f).

Repro:

case <(echo c) in /dev/fd/*) echo fdpath;; *) echo other;; esac

GNU 5.3.0: fdpath (procsub words expand to /dev/fd/N on Linux).
rubash: other — the procsub word is a temp file like /c/Users/.../Temp/rubash-process-subst-<pid>-<counter>.tmp, so every script that pattern-matches /dev/fd/* on a procsub result (a common Linux idiom) takes the wrong branch. The temp path also leaks into stdout when echoed (p022), with a nondeterministic pid component.

Class: platform adaptation divergence with script-visible semantics (GNU scripts written against /dev/fd see a different word). If a real /dev/fd emulation is not feasible, an explicit decision should be recorded; filing so the /dev/fd/* contract is tracked.

GNU C owner: subst.c:6362 process_substitute() — the word is produced as /dev/fd/N (or /dev/stdin variants) via the fd the child reads.
Artifacts: target/issue-suites/results/gnusweep3/cat3/case/p011.* / p022.; minimal target/issue-suites/results/gnusweep3/probes/min/m23-procsub-pathform.

Activity

  1. added
    bug
    gnu-baseline
    on Sep 30, 2026
  2. added 4 commits that reference this issue on Sep 30, 2026
  3. caomengxuan666 commented on Sep 30, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by wt21/resid21 (409ce3ce + captain followup d5d6642, master): the fd-indirection layer is implemented — register_process_substitution_fd opens the highest free fd below 64 (GNU move_to_high_fd parity: first word 63, second 62, echo output byte-identical), carries the payload as FdReadEndpoint::ProcessSubstitution, and the four word-materialization points emit /dev/fd/N; output >(cmd) substitutions get FdWriteEndpoint routing. Consumers reuse the existing mechanisms (argv via materialize_dev_fd_operands, redirects via the dev-fd open paths, plus a new output-target route). 10-form matrix byte-identical; procsub/redir02/substr/ksh/libc 0 diff. The captain followup fixed the one gap the lane slice missed: $(< /dev/fd/N) cat-file now reads the fd-table endpoint (input_snapshot_bytes) instead of fs::read_to_string on the virtual path (caught by the regression golden, fixed in d5d6642). Documented platform residuals: external children printing their own argv filename see the materialized temp path; GNU closes procsub fds at the command boundary (execute_cmd.c:460-466) where we keep them resolvable (superset).

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