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

Re: Wordcode bug with $functions



Peter Stephenson wrote:

> I'm getting a segmentation fault with `print $functions', even patched up
> to date (supposedly). I presume this is a new wordcode feature.  This is
> reproducible with my addpath function by doing `which addpath'.  I narrowed
> it down:  actually, this form doesn't give a crash, but it does show more
> clearly what's going wrong.

When dumping function definitions it didn't set state->pc to the
calculated end.

> By the way, I found this by doing `set' on its own.  This dumps out the
> whole of every function when zsh/parameter is loaded.  Yuck.

And usernames and commands and ... But that's how it's supposed to
work, isn't it? And it was rather ugly before already (e.g. $_comps
and probably other parameters like the caches).

Bye
 Sven

diff -ru ../z.old/Src/text.c Src/text.c
--- ../z.old/Src/text.c	Wed Feb  2 09:34:48 2000
+++ Src/text.c	Wed Feb  2 09:40:40 2000
@@ -182,6 +182,7 @@
 	} _redir;
 	struct {
 	    char *strs;
+	    Wordcode end;
 	} _funcdef;
 	struct {
 	    Wordcode end;
@@ -372,11 +373,13 @@
 		    taddnl();
 		    n = tpush(code, 1);
 		    n->u._funcdef.strs = state->strs;
+		    n->u._funcdef.end = end;
 		    state->strs = (char *) (p + (*state->pc));
 		    state->pc += 2;
 		}
 	    } else {
 		state->strs = s->u._funcdef.strs;
+		state->pc = s->u._funcdef.end;
 		tindent--;
 		taddnl();
 		taddstr("}");

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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