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

Re: Segmentation fault



On Thu, 10 Aug 2017 11:37:51 +0200
Kamil Dudka <kdudka@xxxxxxxxxx> wrote:
> On Wednesday, August 09, 2017 21:45:53 anyinteger@xxxxxxx wrote:
> > Following code causes segmentation fault on zsh :
> > 
> > func(){r;func}
> > func
> 
> I guess this is just another instance of stack overflow caused by infinite 
> shell recursion.

Almost certainly, yes.

> I am aware of two solutions:
> 
> 1. reduce stack usage (compiler flags, move some data from stack to heap)
> 
> 2. recompile zsh with --enable-max-function-depth set to some lower value
>    (the default is 1000)

It's frustrating it's hard to do more than this.  Some vague ideas were
floating around but it's right down at the OS interface which doesn't
give us quite the right sort of information for doing something about
this.

Of course, reducing the default recursion limit is possible but I have
no real feel for what the right compromise is, particularly as it can
affect different architectures / configurations in completely different
ways.

pws



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