From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5031 invoked from network); 30 Sep 2002 18:33:14 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 30 Sep 2002 18:33:14 -0000 Received: (qmail 7039 invoked by alias); 30 Sep 2002 18:33:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17747 Received: (qmail 7027 invoked from network); 30 Sep 2002 18:33:01 -0000 From: "Bart Schaefer" Message-Id: <1020930183230.ZM12902@candle.brasslantern.com> Date: Mon, 30 Sep 2002 18:32:30 +0000 In-Reply-To: <20020930145117.GA35025@victor.teaser.fr> Comments: In reply to Laurent Wacrenier "infinite loop in prompt expansion" (Sep 30, 4:51pm) References: <20020930145117.GA35025@victor.teaser.fr> X-Mailer: Z-Mail (5.0.0 30July97) To: Laurent Wacrenier , zsh-workers@sunsite.dk Subject: PATCH Re: infinite loop in prompt expansion MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 30, 4:51pm, Laurent Wacrenier wrote: } Subject: infinite loop in prompt expansion } } Prompt truncation may enter in infinite loop within litteral escape } sequence : } } % print -P '%{%8<..<%/%}' } (don't give the hand back and spend all CPU time) It shouldn't infinte loop, but I'd like to point out that it also is not intended to do anything useful. %{ ... %} means that the string inside the braces is treated as zero width for purposes of computing the size of the prompt. Truncating a zero width string is a no-op. Hence the fix (which is probably not going to make you happy) is this: Index: prompt.c =================================================================== RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/prompt.c,v retrieving revision 1.6 diff -c -r1.6 prompt.c --- prompt.c 1 Sep 2002 16:47:38 -0000 1.6 +++ prompt.c 30 Sep 2002 18:31:15 -0000 @@ -856,6 +856,10 @@ addbufspc(1); *bp++ = *fm++; } + if (dontcount) { + bp = buf + w; + return 1; + } if (!*fm) return 0; if (bp - buf == w && truncchar == ']') { -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net