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

local variable setting problem/bug



I encountered the following problem when writing a function (this is in zsh  
3.00 on Nextstep, confirmed in zsh 3.01 on Nextstep, zsh 3.00 on Irix and zsh  
2.6-beta13 on linux:

I wanted to create local variables and set them to empty lists (could  
probably done more elegantly, or is maybe unnecessary, but I did it this way):

    myfun ()
    {
	local aopt=() eopt=() dopt=()
	...	

Since the 'locality' did not work I found out that introducing the empty  
lists produced the following effect (using 'functions' to print out what zsh  
thinks about 'myfun'):

    myfun () {
	    local aopt= () {
		    eopt=() dopt=()
	    }
	    ...

This in itself is highly nonintuitive: I guess the first =() is interpreted
as a start of a new function definition, as opposed to a variable
initialization the way I think it should be (or am I mistaken? - I haven't
programmed zsh all that long).

But even worse than that, try the following function:

    bug()
    {
	local a=()
	local b
	local c
    }

On Nextstep 3.3 running zsh 3.00 or zsh 3.01 (with -f option) I get:
	zsh: 24224 segmentation fault  zsh -f

On Linux 1.3.52 running zsh 2.6-beta13 I get (after a while):
	zsh: fatal error: out of memory

And on Irix 5.2 running zsh 3.00 it also consumes memory and
won't terminate normally.

Nevertheless I am very fond of zsh, and therefore I hope you can fix this problem!

------------------------------------------------------------------------
  Robert F. Tobler                 -  tel:+43(1)58801-4585,fax:5874932
  Institute of Computer Graphics   -  mailto:rft@xxxxxxxxxxxxxxx
  Vienna University of Technology  -  http://www.cg.tuwien.ac.at/~rft/



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