zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh workers <zsh-workers@zsh.org>
Subject: Re: r in completion function causes zsh abort
Date: Thu, 08 Nov 2012 07:15:39 -0800	[thread overview]
Message-ID: <121108071539.ZM2792@torch.brasslantern.com> (raw)
In-Reply-To: <20378.1352370323@thecus.kiddle.eu>

On Nov 8, 11:25am, Oliver Kiddle wrote:
}
} After accidentally leaving a spurious `r' in a completion function, zsh
} crashes

"r" will of course attempt to invoke command history; it's not surprising
that doing so down in the guts of a completion function dives into some
code that's not prepared to be called at that juncture.

Sure enough, the stack trace is

abort
free
hend
loop
bin_fc
execbuiltin

(Don't have debugging compiled on the machine where I'm able to test this
right now.)  There's no way bin_fc should be calling the main loop during
completion, and probably not at any time while zle is active (which is a
lot easier to test).

Feel free to suggest a better error message ...

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.267
diff -u -r1.267 builtin.c
--- Src/builtin.c       11 Oct 2012 20:14:03 -0000      1.267
+++ Src/builtin.c       8 Nov 2012 15:14:41 -0000
@@ -1414,6 +1414,12 @@
        unqueue_signals();
        return 0;
     }
+
+    if (zleactive) {
+       zwarnnam(nam, "no interactive history within ZLE");
+       return 1;
+    }
+
     /* put foo=bar type arguments into the substitution list */
     while (*argv && equalsplit(*argv, &s)) {
        Asgment a = (Asgment) zhalloc(sizeof *a);


      reply	other threads:[~2012-11-08 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 10:25 Oliver Kiddle
2012-11-08 15:15 ` Bart Schaefer [this message]

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=121108071539.ZM2792@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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).