Re: Segfault after many stackframes

2019-05-13 Thread Chet Ramey
On 5/4/19 7:56 AM, Ole Tange wrote: >> You've obviously overlooked the FUNCNEST variable and its effects, > > I tried with FUNCNEST: > > $ FUNCNEST=1 > $ re() { t=$((t+1)); if [[ $t -gt 800 ]]; then echo foo; return; > fi; re; }; re > Warning: Program '/bin/bash' crashed. > > So eve

Re: Segfault after many stackframes

2019-05-04 Thread Ole Tange
On Fri, Apr 19, 2019 at 3:16 PM Chet Ramey wrote: > On 4/19/19 4:21 AM, Ole Tange wrote: > > Reading https://www.gnu.org/prep/standards/standards.html#Semantics > > > > """Avoid arbitrary limits on the length or number of any data > > structure, including file names, lines, files, and symbols, by

Re: Segfault after many stackframes

2019-04-19 Thread Chet Ramey
On 4/19/19 4:21 AM, Ole Tange wrote: > > Reading https://www.gnu.org/prep/standards/standards.html#Semantics > > """Avoid arbitrary limits on the length or number of any data > structure, including file names, lines, files, and symbols, by > allocating all data structures dynamically.""" > > Y

Re: Segfault after many stackframes

2019-04-19 Thread Chet Ramey
On 4/19/19 9:16 AM, Chet Ramey wrote: > You've obviously overlooked the FUNCNAME variable Sorry, `FUNCNEST' variable. Muscle memory. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.edu

Re: Segfault after many stackframes

2019-04-19 Thread Greg Wooledge
On Fri, Apr 19, 2019 at 10:21:00AM +0200, Ole Tange wrote: > Of course it is up to you, but if the current behaviour is a > controlled exit working the way it was designed, I find it odd that > there is no mention of it in the docs. Functions may be recursive. The FUNCNEST variable may be

Re: Segfault after many stackframes

2019-04-19 Thread Ole Tange
On Fri, Apr 12, 2019 at 7:18 PM Andrew Church wrote: > > >This recursive function causes bash to segfault: > > > >$ re() { t=$((t+1)); if [[ $t -gt 800 ]]; then echo foo; return; > >fi; re; }; re > >Segmentation fault (core dumped) > > > >Ideally Bash ought to run out of memory before this fai

Re: Segfault after many stackframes

2019-04-12 Thread Eric Blake
On 4/12/19 12:12 PM, Andrew Church wrote: >> This recursive function causes bash to segfault: >> >> $ re() { t=$((t+1)); if [[ $t -gt 800 ]]; then echo foo; return; >> fi; re; }; re >> Segmentation fault (core dumped) >> >> Ideally Bash ought to run out of memory before this fails. But an >> ac

Re: Segfault after many stackframes

2019-04-12 Thread Andrew Church
>This recursive function causes bash to segfault: > >$ re() { t=$((t+1)); if [[ $t -gt 800 ]]; then echo foo; return; >fi; re; }; re >Segmentation fault (core dumped) > >Ideally Bash ought to run out of memory before this fails. But an >acceptable solution could also be to say 'stack overflow'.

Segfault after many stackframes

2019-04-12 Thread Ole Tange
This recursive function causes bash to segfault: $ re() { t=$((t+1)); if [[ $t -gt 800 ]]; then echo foo; return; fi; re; }; re Segmentation fault (core dumped) Ideally Bash ought to run out of memory before this fails. But an acceptable solution could also be to say 'stack overflow'. $ bash