Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug with ZLE special variables and traps?
- X-seq: zsh-workers 27823
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Bug with ZLE special variables and traps?
- Date: Mon, 22 Mar 2010 23:12:34 +0000
- In-reply-to: <20100322160716.5b81001e@news01>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <c16a574a0809181450t61a5b5ddq2e80797fde37636e@xxxxxxxxxxxxxx> <20080919162045.GA22435@xxxxxxxxxxxx> <20090706151644.6BF508027106@xxxxxxxxxxxxxxxxxx> <20090706154309.GA15663@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20090706155337.GB15663@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20100315164237.GA23224@xxxxxxxxxxxxxxxxxxxxxxxxxx> <100320105027.ZM20067@xxxxxxxxxxxxxxxxxxxxxx> <20100322084226.GA26739@xxxxxxxxxxxxxxxxxxxxxxxxxx> <100322075703.ZM21762@xxxxxxxxxxxxxxxxxxxxxx> <20100322160716.5b81001e@news01>
On Mon, 22 Mar 2010 16:07:16 +0000
Peter Stephenson <pws@xxxxxxx> wrote:
> --- Src/lex.c 4 Jan 2010 12:21:09 -0000 1.53
> +++ Src/lex.c 22 Mar 2010 16:03:29 -0000
> @@ -249,6 +249,13 @@ lexsave(void)
> ls->histdone = histdone;
> ls->stophist = stophist;
> stophist = 0;
> + if (!lstack) {
> + /* top level, make this version visible to ZLE */
> + zle_chline = chline;
> + /* ensure line stored is NULL-terminated */
> + if (hptr)
> + *hptr = '\0';
> + }
> ls->hline = chline;
> chline = NULL;
> ls->hptr = hptr;
Oops... I was getting random crashes and valgrind says hptr can be
non-NULL when chline has been freed, which is asking for trouble.
Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.97
diff -p -u -r1.97 hist.c
--- Src/hist.c 22 Mar 2010 16:25:59 -0000 1.97
+++ Src/hist.c 22 Mar 2010 23:11:32 -0000
@@ -1171,7 +1171,7 @@ hend(Eprog prog)
if (histactive & HA_NOINC) {
zfree(chline, hlinesz);
zfree(chwords, chwordlen*sizeof(short));
- chline = NULL;
+ chline = hptr = NULL;
chwords = NULL;
histactive = 0;
unqueue_signals();
@@ -1286,7 +1286,7 @@ hend(Eprog prog)
}
zfree(chline, hlinesz);
zfree(chwords, chwordlen*sizeof(short));
- chline = NULL;
+ chline = hptr = NULL;
chwords = NULL;
histactive = 0;
if (isset(SHAREHISTORY)? histfileIsLocked() : isset(INCAPPENDHISTORY))
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author