Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: redirecting to /dev/stdout 3x in a row
- X-seq: zsh-workers 50410
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Paul <paulsaksela@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Bug: redirecting to /dev/stdout 3x in a row
- Date: Wed, 13 Jul 2022 10:28:47 -0700
- Archived-at: <https://zsh.org/workers/50410>
- In-reply-to: <CAP1=gkOeME2gPrCsO79um18VxCRQBam-9RFN3ytY6mTTHDDkPw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAP1=gkOeME2gPrCsO79um18VxCRQBam-9RFN3ytY6mTTHDDkPw@mail.gmail.com>
On Wed, Jul 13, 2022 at 10:13 AM Paul <paulsaksela@xxxxxxxxx> wrote:
>
> Hello workers of zsh. I noticed that on the latest version, this command:
> ‘echo test > /dev/stdout > /dev/stdout > /dev/stdout’
> Results in an infinite loop of echoing ‘test’. This bug seems to happen only after redirecting output more than 2 times.
Hmm. It's unclear that this is a bug (as opposed to user error).
Redirection to /dev/stdout means that "test" is copied to the output twice.
Redirecting it there again means that both of those outputs are
doubled and that's fed back to the first output.
A third time, all the previous outputs are doubled, again, including
the stuff fed back to the first, which is doubled by the second, etc.
At some point the this exceeds the amount of data that can be buffered
without flushing it, and then you end up never being able to empty the
buffer before more data goes in.
There's nothing the shell can do about this, you've effectively
instructed it to go into an infinite loop.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author