Skip to content

Hang when using <(..) which produes too much data #3817

Closed

Description

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

fish version installed (fish --version):
fish, version 2.5.0
OS/terminal used:
iTerm2, mac os x.

Talk about the the issue here.

It seems any statement which uses <(...) which produces lots of data hangs until all data is gathered.

Reproduction steps

diff <(gunzip -c file1.gz) <(gunzip -c file2.gz) | less with big gzip files, but something simpler like:

cat <(cat /dev/zero) or echo <(cat /dev/zero) seem to hang, can't escape with either ^Z or ^C, have to force-close the shell.

Results

hang

Activity

  1. zanchey commented on Feb 6, 2017

    @zanchey
    Member

    <(...) is not doing what you think it's doing - it's a redirection from a command substitution (i.e. redirects standard input to the output of cat /dev/zero etc.

    You're looking for process substitution - see the psub builtin function.

  2. ChrisJefferson commented on Feb 6, 2017

    @ChrisJefferson
    Author

    Ah, so it behaves differently to bash (where my diff statement would have been correct). I was assuming it did the same thing as there.

  3. ChrisJefferson commented on Feb 6, 2017

    @ChrisJefferson
    Author

    Ah, now I understand what's going on, (echo 1) is the same as 1, so <(echo 1) is the same as <1.

    However, if I feed in something stupid, fish still shouldn't explode and swallow 16GB or ram or so (I've noticed even when I closed the terminal window, fish was still running in the background swallowing RAM) :) Is there any reason to bother reading more than the maximum length of a command line?

  4. krader1961 commented on Feb 7, 2017

    @krader1961
    Contributor

    Is there any reason to bother reading more than the maximum length of a command line?

    There is no such limit. However, in the same vein as issue #3712 to limit how much data read will consume, we should probably impose the same, or a similar, limit on the output of a command substitution.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions