bug-bash
[Top][All Lists]
Advanced

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

Re: [BUG] Bash segfaults on an infinitely recursive funcion


From: Chet Ramey
Subject: Re: [BUG] Bash segfaults on an infinitely recursive funcion
Date: Sun, 24 Sep 2017 13:37:48 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 9/24/17 9:25 AM, Shlomi Fish wrote:
> Hi all,
> 
> With bash git master on Mageia v7 x86-64, bash on Debian Stable and other
> reported sytems:
> 
> address@hidden:~$ /home/shlomif/apps/bash/bin/bash -c 'run() { run; } ; run'
> Segmentation fault (core dumped)
> address@hidden:~$ 
> 
> note that this is not a fork bomb as no processes are spawned, and it is also
> not an out-of-memory problem. I expect bash to fail on this, but it ought not
> to segfault.

This has come up many times in the past.

You wrote a recursive function that eventually exceeds your shell's
stack space allocation, and the kernel sends it a SIGSEGV.

If you want to constrain function recursion, look at the FUNCNEST
shell variable.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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