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

Re: Segfaulting script

On Jun 16,  1:03pm, Frank Terbeck wrote:
} I don't know if this is the same bug, but it might be closely related:
} [snip]
} % zsh -f
} % testfunc() { local foo=() ; local bar }

You can't assign values to an array in a "local" statement.  When zsh
parses the above, it's seeing

	()	<-- empty parens means we're defining a function!

The result is that you define both "local" and "foo=" as the names of
functions, each of which has the function body

	local bar

which (of course) is a recursive call to the newly-created function
"local".  I don't get a segfault with 4.3.2-dev-1, I get an error:

zsh% local
local:10: maximum nested function level reached

The fact that "compinit" or a completion comes next is a red herring; any
function that used "local" would cause the error.

My guess would be that you get a segfault when the compile-time setting
of the maximum function depth is large enough that you run out of memory
before the limit is hit.  There's not a whole lot we can do about that.

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