zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: DervishD <zsh@dervishd.net>
Cc: Zsh Workers <zsh-workers@sunsite.dk>
Subject: Re: Bug? in complist when filenames are longer than the screen
Date: Tue, 04 Oct 2005 02:07:17 +0000	[thread overview]
Message-ID: <1051004020717.ZM5616@candle.brasslantern.com> (raw)
In-Reply-To: <20051003184822.GA3240@DervishD>

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)


  reply	other threads:[~2005-10-04  2:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-03 14:45 DervishD
2005-10-03 17:45 ` Andrey Borzenkov
2005-10-03 18:48   ` DervishD
2005-10-04  2:07     ` Bart Schaefer [this message]
2005-10-04  4:39       ` PATCH? - " Bart Schaefer
2005-10-04  9:48         ` DervishD
2005-10-04 10:38           ` Peter Stephenson
2005-10-04 10:47             ` DervishD
2005-10-04 11:19               ` Peter Stephenson
2005-10-04 11:31                 ` DervishD
2005-10-04 14:32             ` Bart Schaefer
2005-10-04 14:09           ` Bart Schaefer
2005-10-04 16:37             ` DervishD
2005-10-04 16:11 ` Bart Schaefer
2005-10-04 17:13   ` DervishD
2005-10-04 19:24     ` Andrey Borzenkov
2005-10-04 20:41       ` DervishD
2005-10-06 16:01       ` Bart Schaefer
2005-10-06 16:31         ` DervishD

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=1051004020717.ZM5616@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    --cc=zsh@dervishd.net \
    /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).