From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5699 invoked from network); 4 Oct 2005 02:07:44 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Oct 2005 02:07:44 -0000 Received: (qmail 53524 invoked from network); 4 Oct 2005 02:07:33 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Oct 2005 02:07:33 -0000 Received: (qmail 8101 invoked by alias); 4 Oct 2005 02:07:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21818 Received: (qmail 8092 invoked from network); 4 Oct 2005 02:07:29 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Oct 2005 02:07:29 -0000 Received: (qmail 53239 invoked from network); 4 Oct 2005 02:07:28 -0000 Received: from vms040pub.verizon.net (206.46.252.40) by a.mx.sunsite.dk with SMTP; 4 Oct 2005 02:07:27 -0000 Received: from candle.brasslantern.com ([71.116.81.225]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0INT00G8OCK71AS7@vms040.mailsrvcs.net> for zsh-workers@sunsite.dk; Mon, 03 Oct 2005 21:07:21 -0500 (CDT) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j9427IHt005618; Mon, 03 Oct 2005 19:07:19 -0700 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j9427IgJ005617; Mon, 03 Oct 2005 19:07:18 -0700 Date: Tue, 04 Oct 2005 02:07:17 +0000 From: Bart Schaefer Subject: Re: Bug? in complist when filenames are longer than the screen In-reply-to: <20051003184822.GA3240@DervishD> To: DervishD Cc: Zsh Workers Message-id: <1051004020717.ZM5616@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <20051003144536.GA3179@DervishD> <200510032145.07748.arvidjaar@newmail.ru> <20051003184822.GA3240@DervishD> Comments: In reply to DervishD "Re: Bug? in complist when filenames are longer than the screen" (Oct 3, 8:48pm) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) 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.0.4 On Oct 3, 8:48pm, DervishD wrote: } } The above, when run after "zsh -f" and making sure you don't have } any /etc/zshenv not protected by "[[ -o rcs ]]", causes a hangup (not } a crash) in my system. Unfortunately the crash happens randomly See if the following patch reduces the problem to something reproducible. I don't really know what the problem is, but all of the following are defensive changes against possible infinite loops. Index: Src/Zle/complist.c --- current/Src/Zle/complist.c Sun Oct 2 18:38:17 2005 +++ Src/Zle/complist.c Mon Oct 3 19:02:17 2005 @@ -831,7 +831,7 @@ selectlocalmap(NULL); settyinfo(&shttyinfo); putc('\r', shout); - for (i = columns - 1; i--; ) + for (i = columns - 1; i-- > 0; ) putc(' ', shout); putc('\r', shout); @@ -1148,7 +1148,7 @@ if (mselect >= 0) { int mm = (mcols * ml), i; - for (i = mcols; i--; ) { + for (i = mcols; i-- > 0; ) { mtab[mm + i] = mtmark(NULL); mgtab[mm + i] = mgmark(NULL); } @@ -1469,12 +1469,12 @@ int mm = (mcols * ml), i; if (m->flags & CMF_DUMMY) { - for (i = mcols; i--; ) { + for (i = mcols; i-- > 0; ) { mtab[mm + i] = mtmark(mp); mgtab[mm + i] = mgmark(g); } } else { - for (i = mcols; i--; ) { + for (i = mcols; i-- > 0; ) { mtab[mm + i] = mp; mgtab[mm + i] = g; } @@ -1523,12 +1523,12 @@ int mm = mcols * ml, i; if (m->flags & CMF_DUMMY) { - for (i = (width ? width : mcols); i--; ) { + for (i = (width ? width : mcols); i-- > 0; ) { mtab[mx + mm + i] = mtmark(mp); mgtab[mx + mm + i] = mgmark(g); } } else { - for (i = (width ? width : mcols); i--; ) { + for (i = (width ? width : mcols); i-- > 0; ) { mtab[mx + mm + i] = mp; mgtab[mx + mm + i] = g; } @@ -2142,7 +2142,7 @@ Cmatch **p = mtab; for (y = 0; y < mlines; y++) { - for (x = mcols; x; x--, p++) + for (x = mcols; x > 0; x--, p++) if (*p && !mmarked(*p) && **p && mselect == (**p)->gnum) break; if (x) { @@ -2162,7 +2162,7 @@ int c; while (mlbeg) { - for (q = p, c = columns; c; q++, c--) + for (q = p, c = columns; c > 0; q++, c--) if (*q && !mmarked(*q)) break; if (c) @@ -2180,7 +2180,7 @@ int c; while (mlbeg < mlines) { - for (q = p, c = columns; c; q++, c--) + for (q = p, c = columns; c > 0; q++, c--) if (*q) break; if (c)