zsh-workers
 help / color / mirror / code / Atom feed
* Re: dirstack history: loving zsh, crashing zsh...
       [not found] <20060302175252.GA31734@let.rug.nl>
@ 2006-03-03 22:23 ` Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2006-03-03 22:23 UTC (permalink / raw)
  To: Francisco Borges, Zsh hackers list

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@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-03 22:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20060302175252.GA31734@let.rug.nl>
2006-03-03 22:23 ` dirstack history: loving zsh, crashing zsh Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).