Skip to content

In Windows Subsystem for Linux, piping from cat to sed causes an error. #3454

Closed

Description

@robertoloja
  • Have you checked if problem occurs with fish 2.3.1?
  • Tried fish without third-party customizations (check sh -c 'env HOME=$(mktemp -d) fish')?

fish version installed (fish --version): 2.3.1

OS/terminal used: Windows 10 (Windows Subsystem for Linux), mintty (also checked on cmd.exe)

Reproduction steps

  1. Launch a WSL terminal (cmd.exe or mintty; the bug is reproducible in both). By default, this will be bash.
  2. Launch fish.
  3. Create a text file.
  4. Pipe the contents of the text file through sed with a simple substitution.

Results

~ $  echo "text" > file.txt
~ $  cat file.txt | sed 's/e/f/g'
Could not send process 212, 'sed' in job 1, 'cat file.txt | sed 's/e/f/g'' from group 3 to group 211
setpgid: Operation not permitted
sed: read error on stdin: Input/output error
~ $

Notes

Piping from echo to sed works as expected.
The above steps work as expected in bash, both in mintty and cmd.exe

Activity

  1. added
    bug
    on Oct 14, 2016
  2. faho commented on Oct 14, 2016

    @faho
    Member

    The obvious question here is if this is something fish should do anything about. WSL is meant to be bug-for-bug binary compatible with linux, and I've never seen this error in linux.

    Of course it's possible this is something we should cope with.

  3. krader1961 commented on Oct 14, 2016

    @krader1961
    Contributor

    FWIW,I can reproduce the problem. Replacing cat with head and tail fail in a similar manner. But using grep works because it's a function that wraps the external command and thus doesn't fork that side of the pipe. This is clearly an artifact of an incomplete mapping of Linux semantics for process management to the Windows model. TBD is whether there is anything fish can reasonably do to workaround this WSL quirk.

  4. added this to the fish-future milestone on Oct 22, 2016
  5. ridiculousfish commented on Oct 22, 2016

    @ridiculousfish
    Member

    This seems surprising to me - why isn't bash, etc. affected? I'll try to take a look.

  6. saschagehlich commented on Nov 24, 2016

    @saschagehlich

    @ridiculousfish Were you able to find something out about this?

  7. ridiculousfish commented on Nov 26, 2016

    @ridiculousfish
    Member

    I had to reinstall Windows and haven't taken a look yet

  8. krader1961 commented on Apr 6, 2017

    @krader1961
    Contributor

    I updated my Windows 10 WSL environment and fish. I can no longer reproduce this failure so I'm closing the issue.

  9. locked as resolved and limited conversation to collaborators on Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugwindows subsystem for linux

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions