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

Re: Wordcode functions with empty bodies



On Jun 14,  8:14am, Sven Wischnowsky wrote:
} Subject: Re: Wordcode functions with empty bodies
}
} I had a little debugging session yesterday evening... I could
} reproduce the segv with the `prompt' thing (although I had to invoke
} `prompt bart' a second time with some other command before it to make
} it go kaboom).
} 
} I could not, however, see any problems with bld_eprog(). In which way
} do you think it produces garbled eprogs? (I mean, what do those eprogs 
} look like?)

They have a `len' of 4 and a `strs' that points to four bytes of garbage.
The crashes appear to happen after dupeprog() copies `strs' -- the new
copy often ends up pointing to a different four bytes of garbage.

In the prompt stuff, as long as I never let the function body be empty --
that is, I replace e.g.

        functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch}"

with

        functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch/:}"

the crashes never happen.  Only if the function body becomes empty do I
have any problem.
 
} Ok. If you could give me an easy example of how to make bld_eprog()
} give garbled results, I'd be thankful. Just doing `functions[foo]=""'
} at least gives me sensible results.

Try `functions[foo]=" "' so there is a non-empty string there but it
contains no useful tokens.

I'll try to do some more debugging this morning and send some gdb output.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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