bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segmentation Fault in bash --posix


From: David
Subject: Re: Segmentation Fault in bash --posix
Date: Sat, 21 Jan 2023 09:40:07 +1100

On Sat, 21 Jan 2023 at 09:24, N R <nicolas.reyland@gmail.com> wrote:

>     I ran into a segmentation fault running bash --posix. Here are the
> steps to reproduce :
>     bash-5.1$ echo () { echo test }
>     > echo test
>     > }
>     bash-5.1$ echo
>     Even though I'm not sure what is causing this seg fault, I'm sure it is
> not the normal/expected behaviour.

That is the normal expected behaviour.

What do you expect this should do:
$ foo() { foo ; } ; foo

This code instructs the function foo to call itself again
and again without limit forever.

So it tries to do that until the process entirely fills its call
stack with return addresses and runs out of memory
resources at which point the operating system will kill
the process.

That's not bash' fault. That's the programmers fault.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]