From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1399 invoked by alias); 28 Oct 2014 16:24:09 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33563 Received: (qmail 7497 invoked from network); 28 Oct 2014 16:24:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=GLe/yVJP c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=ozdahbXWWCwdr2xLMOQA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <141028092406.ZM10512@torch.brasslantern.com> Date: Tue, 28 Oct 2014 09:24:06 -0700 In-reply-to: <20141027144055.GA22442@xvii.vinc17.org> Comments: In reply to Vincent Lefevre "Re: Crash after interrupting tab-completion with Ctrl-\" (Oct 27, 3:40pm) References: <20141027003854.GA25689@xvii.vinc17.org> <141026183105.ZM8141@torch.brasslantern.com> <141026191818.ZM8256@torch.brasslantern.com> <20141027144055.GA22442@xvii.vinc17.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Crash after interrupting tab-completion with Ctrl-\ MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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))