From: Bart Schaefer <schaefer@brasslantern.com>
To: Thomas Eriksson <thomas.eriksson@tokyo.com>, zsh-workers@sunsite.dk
Subject: Re: zsh segfault
Date: Fri, 24 Aug 2001 16:00:35 -0700 [thread overview]
Message-ID: <010824160035.ZM28716@candle.brasslantern.com> (raw)
In-Reply-To: <2796937.998645002276.JavaMail.root@suntea.algonet.se>
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;
}
}
next prev parent reply other threads:[~2001-08-24 23:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-24 9:23 Thomas Eriksson
2001-08-24 23:00 ` Bart Schaefer [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-08-23 22:03 Thomas Eriksson
2001-08-24 1:47 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=010824160035.ZM28716@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=thomas.eriksson@tokyo.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).