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

Re: dirstack history: loving zsh, crashing zsh...



Francisco Borges wrote:
> % typeset -U dirstack
> 
> and the shell crashed. (I kid you not!)

This fixes this one... however, there could be a lot of other places
where the consequences of manipulating a special array haven't been
thought through, so it would be good to keep a watch out.

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.152
diff -u -r1.152 builtin.c
--- Src/builtin.c	2 Mar 2006 22:05:25 -0000	1.152
+++ Src/builtin.c	3 Mar 2006 22:20:38 -0000
@@ -1924,8 +1924,9 @@
 	    Param apm;
 	    char **x;
 	    if (PM_TYPE(pm->flags) == PM_ARRAY) {
-		x = (*pm->gsu.a->getfn)(pm);
+		x = zarrdup((*pm->gsu.a->getfn)(pm));
 		uniqarray(x);
+		pm->gsu.a->setfn(pm, x);
 		if (pm->ename && x)
 		    arrfixenv(pm->ename, x);
 	    } else if (PM_TYPE(pm->flags) == PM_SCALAR && pm->ename &&

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/



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