zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Crash after interrupting tab-completion with Ctrl-\
Date: Tue, 28 Oct 2014 09:24:06 -0700	[thread overview]
Message-ID: <141028092406.ZM10512@torch.brasslantern.com> (raw)
In-Reply-To: <20141027144055.GA22442@xvii.vinc17.org>

On Oct 27,  3:40pm, Vincent Lefevre wrote:
} Subject: Re: Crash after interrupting tab-completion with Ctrl-\
}
} $ ls Mail/oldarc/cur/1[TAB]
} zsh: do you wish to see all 140500 possibilities (70251 lines)? 
} 
} Then I type 'y', followed by Ctrl-\.

Ok, so this isn't really a crash -- it's the default response to a QUIT
signal.  I just did a quick check and the QUIT handler is not reset, so
this is as expected, except that the stty quit character is supposed to
be disabled at this point (I think).  So the questions are:

- How did the quit character get re-enabled? - and

- Why doesn't INT work here?

I'm not too worried about the first one, since it seems to have been
fortuitous.  As for the latter, the following patch is not perfect --
it causes some screen-repaint problems if you manage to send the INT
before the first test of !errflag, and I may have gone overboard with
places the flag is tested -- but please see if it allows you to stop
that 70k-line listing.

Also fixed thinko in the _main_complete trap, although we've already
left _main_complete by the time printcomplist() is running.

diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index e881ea6..fcd6366 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -128,7 +128,7 @@ _completer_num=1
 
 # We assume localtraps to be in effect here ...
 integer SECONDS=0
-trap 'zle -M "Killed by signal in ${funcstack[0]} after ${SECONDS}s";
+trap 'zle -M "Killed by signal in ${funcstack[1]} after ${SECONDS}s";
       zle -R; return 130' INT QUIT
 
 # Call the pre-functions.
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 5e5ba9f..2e1a527 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1375,7 +1375,7 @@ compprintlist(int showall)
 	tcout(TCCLEAREOD);
 
     g = ((lasttype && lastg) ? lastg : amatches);
-    while (g) {
+    while (g && !errflag) {
 	char **pp = g->ylist;
 
 #ifdef ZSH_HEAP_DEBUG
@@ -1389,7 +1389,7 @@ compprintlist(int showall)
 		ml = lastml;
 		lastused = 1;
 	    }
-	    while (*e) {
+	    while (*e && !errflag) {
 		if (((*e)->count || (*e)->always) &&
 		    (!listdat.onlyexpl ||
 		     (listdat.onlyexpl & ((*e)->always > 0 ? 2 : 1)))) {
@@ -1469,11 +1469,11 @@ compprintlist(int showall)
 
 		nl = nc = g->lins;
 
-		while (n && nl--) {
+		while (n && nl-- && !errflag) {
 		    i = g->cols;
 		    mc = 0;
 		    pq = pp;
-		    while (n && i--) {
+		    while (n && i-- && !errflag) {
 			if (pq - g->ylist >= g->lcount)
 			    break;
 			if (compzputs(*pq, mscroll))
@@ -1582,7 +1582,7 @@ compprintlist(int showall)
 	    } else
 		p = skipnolist(g->matches, showall);
 
-	    while (n && nl--) {
+	    while (n && nl-- && !errflag) {
 		if (!lasttype && ml >= mlbeg) {
 		    lasttype = 3;
 		    lastg = g;
@@ -1596,7 +1596,7 @@ compprintlist(int showall)
 		i = g->cols;
 		mc = 0;
 		q = p;
-		while (n && i--) {
+		while (n && i-- && !errflag) {
 		    wid = (g->widths ? g->widths[mc] : g->width);
 		    if (!(m = *q)) {
 			if (clprintm(g, NULL, mc, ml, (!i), wid))


  parent reply	other threads:[~2014-10-28 16:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27  0:38 Vincent Lefevre
2014-10-27  1:31 ` Bart Schaefer
2014-10-27  2:18   ` Bart Schaefer
2014-10-27  8:16     ` Mikael Magnusson
2014-10-27 14:40     ` Vincent Lefevre
2014-10-27 14:51       ` Vincent Lefevre
2014-10-28 16:24       ` Bart Schaefer [this message]
2014-10-27 14:32   ` Vincent Lefevre

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=141028092406.ZM10512@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).