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

Re: zsh 5.3.1 crashes on completion



On Mon, 15 May 2017 13:33:54 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> It's a bit more subtle than that.  The current history line (chline)
> is actually pointing into the previous event, which is being taken as
> a duplicate of *itself*.

This is certainly murky.  The loop(0, 1) in bin_fc is a one-off, not
like anything else in the shell, and fc, as you already implied, isn't
really fit for running non-interactively anyway.

zcontext_save() in loop() will run, since this isn't a top-level loop,
which will save and clear chline.  So it should be the case the the loop
we have for fc has a clean history state.  So I wonder if something else to do
with the state (that maybe we should be saving and clearing at the same
time?) is screwy owing to not having finished the top-level history
line.  Either that, or something is running twice in the subshell when
it shouldn't.

I'm not seeing the falling call debug trigger, anyway, though it's quite
hard to see in the case with the memory corruption which is reporting
errors from glibc.  Promoting it to a hard error with a return didn't
seem to make any difference, either.

pws

diff --git a/Src/hist.c b/Src/hist.c
index 350688d..c68b2ae 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1035,6 +1035,7 @@ hbegin(int dohist)
 	stophist = (!interact || unset(SHINSTDIN)) ? 2 : 0;
     else
 	stophist = 0;
+    DPUTS(chline != NULL, "chline set at start of history");
     /*
      * pws: We used to test for "|| (inbufflags & INP_ALIAS)"
      * in this test, but at this point we don't have input



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