Skip to content

FIFO File Descriptors Created in process substitution aren't handled consistently #1120

Closed
@cfogrady

Description

@cfogrady

At the moment an OpenHandler can be provided to an interp.Runner as a RunnerOption.

When a process substitution creates a FIFO path it is created on the os filesystem; however, later operations sent to it treat it as a normal file sent to the OpenHandler. This has a side effect that if the OpenHandler is mocked or is sandboxed in some way, that the open file for the process substitution's named pipe hangs because writes are going to the wrong file.

I would propose one of the following:

  1. Changing documentation such that users are specifically warned against sandboxing OpenHandler because of such scenarios
  2. Changing the https://github.com/mvdan/sh/blob/master/interp/runner.go#L107 and https://github.com/mvdan/sh/blob/master/interp/runner.go#L120 to use the OpenHandler instead of directly interacting with the OS, which may also involve a handler for removing the file
  3. Provide a way to internally differentiate between Named Pipes and regular files before the OpenHandler is called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions