Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: segfault in mkundoent when completing
- X-seq: zsh-users 20825
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: "Dirk-Jan C. Binnema" <djcb@xxxxxxxxxxxxxxx>
- Subject: Re: segfault in mkundoent when completing
- Date: Mon, 26 Oct 2015 09:49:41 +0000
- Cc: zsh-users@xxxxxxx
- In-reply-to: <87fv0ym71h.fsf@djcbsoftware.nl>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <874mhfe8ng.fsf@djcbsoftware.nl> <151025095136.ZM29675@torch.brasslantern.com> <87y4eqahet.fsf@djcbsoftware.nl> <151025180706.ZM30568@torch.brasslantern.com> <87fv0ym71h.fsf@djcbsoftware.nl>
On Mon, 26 Oct 2015 09:18:50 +0200
Dirk-Jan C. Binnema <djcb@xxxxxxxxxxxxxxx> wrote:
> Hmmm, it seems some kind of interaction between a few different things;
> but I was amble to reproduce it with this ~/.zshrc (using the external
> highlighting package):
>
> --8<---------------cut here---------------start------------->8---
> setopt allexport
> autoload -U compinit
> compinit
> source ~/Sources/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
> --8<---------------cut here---------------end--------------->8---
Yes, this is showing it's...
> Hmm... the change in question adds mkundoent() in a different context.
> I'm wondering if that UNMETACHECK() just above the crash might go off if
> this were copmiled with --enable-zsh-debug. But I couldn't get this to
> happen easily myself, even adding an extra DPUTS().
I presume there are now a few extra hooks around causing it to happen in
completion context.
The easiest thing is to add protection we've already get in
handleundo(), which I've just copied verbatim.
pws
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 714d911..ffff8fd 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1739,9 +1739,26 @@ zlecallhook(char *name, char *arg)
zlong
get_undo_current_change(UNUSED(Param pm))
{
+ int remetafy;
+
+ /*
+ * Yuk: we call this from within the completion system,
+ * so we need to convert back to the form which can be
+ * copied into undo entries.
+ */
+ if (zlemetaline != NULL) {
+ unmetafy_line();
+ remetafy = 1;
+ } else
+ remetafy = 0;
+
/* add entry for any pending changes */
mkundoent();
setlastline();
+
+ if (remetafy)
+ metafy_line();
+
return undo_changeno;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author