Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Crashing the Linux System



On Fri, Jun 16, 2023 at 8:38 PM LitHack <lithack0@xxxxxxxxx> wrote:
>
> Running the yes command in command substitution will crash the linux shell. According to me inside command the substitution it is creating multiple process(fork).  Command: `yes` or $(yes)

The "yes" command is defined to produce an unending stream of output.
The $(...) substitution is defined to capture all the output from a
command and substitute it as a string.  "All the output" of "yes" is
impossible to capture in finite memory.  The error I get from zsh is
the expected one:
zsh: fatal error: out of heap memory
There definitely are not multiple forks happening.

This is not a bug except in the sense that it was user error to use
$(yes) in the first place.  It's no different than deliberately
writing an infinite loop such as $(while true; do echo y; done).




Messages sorted by: Reverse Date, Date, Thread, Author