From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 642 invoked from network); 28 Feb 2008 23:10:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Feb 2008 23:10:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 66520 invoked from network); 28 Feb 2008 23:10:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Feb 2008 23:10:39 -0000 Received: (qmail 27689 invoked by alias); 28 Feb 2008 23:10:34 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24627 Received: (qmail 27675 invoked from network); 28 Feb 2008 23:10:33 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 28 Feb 2008 23:10:33 -0000 Received: from mtaout03-winn.ispmail.ntl.com (mtaout03-winn.ispmail.ntl.com [81.103.221.49]) by bifrost.dotsrc.org (Postfix) with ESMTP id 5FB2F8026E0B for ; Fri, 29 Feb 2008 00:10:30 +0100 (CET) Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20080228231312.UYRX19530.mtaout03-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Thu, 28 Feb 2008 23:13:12 +0000 Received: from pws-pc ([81.107.42.63]) by aamtaout04-winn.ispmail.ntl.com with ESMTP id <20080228231033.SXCI29112.aamtaout04-winn.ispmail.ntl.com@pws-pc> for ; Thu, 28 Feb 2008 23:10:33 +0000 Date: Thu, 28 Feb 2008 23:10:25 +0000 From: Peter Stephenson To: zsh-workers Subject: Re: menu-select crashes and redraw problems Message-ID: <20080228231025.2eb9715a@pws-pc> In-Reply-To: <237967ef0712222224y3acd07c4oe6843d366f763b25@mail.gmail.com> References: <237967ef0712222224y3acd07c4oe6843d366f763b25@mail.gmail.com> X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.91.2/6031/Thu Feb 28 23:27:54 2008 on bifrost X-Virus-Status: Clean On Sun, 23 Dec 2007 07:24:48 +0100 "Mikael Magnusson" wrote: > When i use menu-select and resize the terminal while the select is > going on (no, I don't usually do this :) ), zsh usually crashes after > a couple of tries. It almost always messes up the display of the list > after a resize, sometimes it fixes itself when you scroll around, > sometimes not. I reproduced it with zsh -f like this > > zsh -f > zmodload zsh/complist > ls menu-select > * > > > After an hour or two chasing red herrings around gum trees, I came up with this. It's not the end of the story, since the display seems to get messed up occasionally, but it does seem to reduce or possibly eliminate crashes. This is one of those "please don't ask me what it does" fixes, but I think the story is cases like this are mostly handled and it simply didn't try quite as hard as it could to fix up lines and columns. I suspect that in principle there are horrific races such that if SIGWINCH arrives when the code is anywhere other than waiting for a key press pretty much anything can happen. I am successfully ignoring this so far and hope to continue doing so. As you'll see in the first hunk, I've added a detailed explanatory comment to one of the many sophisticated features of the code. Index: Src/Zle/complist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v retrieving revision 1.107 diff -u -r1.107 complist.c --- Src/Zle/complist.c 15 Feb 2008 22:01:05 -0000 1.107 +++ Src/Zle/complist.c 28 Feb 2008 22:51:40 -0000 @@ -122,7 +122,11 @@ int mgtabsize; #endif -/* Used in mtab/mgtab, for explanations. */ +/* + * Used in mtab/mgtab, for explanations. + * + * UUUUUUUUUUUUUUURRRRGHHHHHHHHHH!!!!!!!!! --- pws + */ #define MMARK ((unsigned long) 1) #define mmarked(v) (((unsigned long) (v)) & MMARK) @@ -2325,8 +2329,7 @@ for (;;) { METACHECK(); - mtab_been_reallocated = 0; - if (mline < 0) { + if (mline < 0 || mtab_been_reallocated) { int x, y; Cmatch **p = mtab; @@ -2342,6 +2345,7 @@ if (y < mlines) mline = y; } + mtab_been_reallocated = 0; DPUTS(mline < 0, "BUG: mline < 0 after re-scanning mtab in domenuselect()"); while (mline < mlbeg) -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/