Skip to content

Process substitution FIFO of a background job that still runs at shell exit stays in /tmp #245

Open

Description

@hyperpolymath

Follow-up from #242 (owner ruling AD2, 2026-11-19).

What happens

cmd <(x) & makes a FIFO under /tmp (vsh-fifo-<shell pid>-*). Since #242, the job table keeps the substitution until the job ends. A SIGCHLD flag and polling at safe points then reap the job, release the substitution and remove the FIFO. At exit, the shell cleans the jobs that have ended.

One case is left: if a background job still runs when the shell exits, the shell does not remove its FIFO. It leaves the substitution to the job on purpose (ProcessSubstitution::leave_running), because the job may still open the FIFO. The job still gets its input, but the FIFO file stays in /tmp after the job ends. If the job never opens the FIFO, the substitution's child also stays blocked.

Example (checked on 1e6ba50): run

vsh -c "sh -c 'sleep 2; cat \"\$1\"' sh <(pwd) > out &"

vsh exits at once. After 3 seconds, out holds the path and one vsh-fifo-* file is still in /tmp.

The limit is stated in a // snip: comment on impl Drop for JobTable in impl/rust-cli/src/job.rs.

Options to consider

  • Unlink the FIFO path once the job has opened it. The open descriptor keeps working, but the shell needs to know when the open happened.
  • Use an anonymous pipe passed as /dev/fd/N where the platform has it, as bash does, so that no file exists.
  • Hand cleanup to a small detached helper that waits for the job and then removes the FIFO.

Each option changes the process substitution design, so it needs a decision before work starts.

Activity

  1. coderabbitai commented on Nov 19, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #242 - fix(glob): bound expansion while it runs; stop ** following symlinks [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    bugSomething is broken or behaves incorrectly
    scope:repoConfined to this repository
    decisionA ruling is required before work can proceed
    on Nov 19, 2026
  3. hyperpolymath commented on Nov 19, 2026

    @hyperpolymath
    OwnerAuthor

    One more case belongs here, since 3e53e52. A background job can end while its connected substitution still works, for example sh -c 'printf data > "$1"' sh >(sh -c 'sleep 5; cat > out') &. The shell no longer waits for that substitution: it checks it at each safe point. If the shell exits first, the substitution is left to finish, and its FIFO stays in /tmp, as for a job that still runs. The same options apply.


    Generated by Claude Code

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

    bugSomething is broken or behaves incorrectlydecisionA ruling is required before work can proceedpriority:p2Normal - queue itscope:repoConfined to this repository

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions