Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh segfault
- X-seq: zsh-workers 15707
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Thomas Eriksson <thomas.eriksson@xxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Subject: Re: zsh segfault
- Date: Fri, 24 Aug 2001 16:00:35 -0700
- In-reply-to: <2796937.998645002276.JavaMail.root@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <2796937.998645002276.JavaMail.root@xxxxxxxxxxxxxxxxx>
On Aug 24, 11:23am, Thomas Eriksson wrote:
>
> printf "unset -f precmd \n" 1>/home/arne/wuf
> alias wuf="echo wuf wuf;precmd () { . /home/arne/wuf ; }"
> wuf
The alias isn't necessary; so is the unset -f. Any "." or "source"
command from within precmd() gives:
BUG: chline is NULL in hend()
(which is only visible with configure --enable-zsh-debug).
This is happening because source() re-enters loop(), which clobbers the
hbegin(1) at the top of the function. The following fixes it, but I'm
wondering if there's a better way.
(The reason this doesn't happen in 3.0.x is that the hbegin() in loop()
happens later, after preprompt() -- but 4.0.x has a bunch of special
variables that might be used in `precmd' and that refer to the history,
so the initialization has to happen sooner.)
Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.18.4.1
diff -c -r1.18.4.1 init.c
--- Src/init.c 2001/06/30 18:30:07 1.18.4.1
+++ Src/init.c 2001/08/24 22:53:36
@@ -107,6 +107,8 @@
pushheap();
for (;;) {
freeheap();
+ if (stophist == 3) /* re-entry via preprompt() */
+ hend(NULL);
hbegin(1); /* init history mech */
if (isset(SHINSTDIN)) {
setblock_stdin();
@@ -114,7 +116,10 @@
int hstop = stophist;
stophist = 3;
preprompt();
- stophist = hstop;
+ if (stophist != 3)
+ hbegin(1);
+ else
+ stophist = hstop;
errflag = 0;
}
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author