From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26413 invoked from network); 25 Apr 2006 17:33:03 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 25 Apr 2006 17:33:03 -0000 Received: (qmail 22652 invoked from network); 25 Apr 2006 17:32:55 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Apr 2006 17:32:55 -0000 Received: (qmail 23553 invoked by alias); 25 Apr 2006 17:32:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22432 Received: (qmail 23544 invoked from network); 25 Apr 2006 17:32:51 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 25 Apr 2006 17:32:51 -0000 Received: (qmail 22358 invoked from network); 25 Apr 2006 17:32:51 -0000 Received: from cluster-d.mailcontrol.com (217.69.20.190) by a.mx.sunsite.dk with SMTP; 25 Apr 2006 17:32:50 -0000 Received: from exchange03.csr.com (uuk202166.uk.customer.alter.net [62.189.241.194] (may be forged)) by rly28d.srv.mailcontrol.com (MailControl) with ESMTP id k3PHWmR7019710 for ; Tue, 25 Apr 2006 18:32:48 +0100 Received: from csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 25 Apr 2006 18:32:48 +0100 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: another pattern buglet Date: Tue, 25 Apr 2006 18:32:48 +0100 From: Peter Stephenson Message-ID: X-OriginalArrivalTime: 25 Apr 2006 17:32:48.0089 (UTC) FILETIME=[451E3490:01C6688E] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-06-00-05 (www.mailcontrol.com) on 10.68.0.138 Here's an even more subtle bug in pattern.c fixed. Backtracking over repeated single characters (other than "?" as ?# is optimised to "*") was broken by miscounting the number of times it could be done. This was quite well hidden. It's quite likely that the fundamental logical error existed before the change for multibyte characters, but didn't show up; I only found it on Solaris during the completion tests. Index: Src/pattern.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/pattern.c,v retrieving revision 1.32 diff -u -r1.32 pattern.c --- Src/pattern.c 25 Apr 2006 13:01:53 -0000 1.32 +++ Src/pattern.c 25 Apr 2006 17:25:30 -0000 @@ -2751,22 +2751,26 @@ savglobflags = patglobflags; saverrsfound = errsfound; lastcharstart = charstart + (patinput - start); - while (no >= min) { - int charmatch_cache; - if (nextch < 0 || - (patinput < patinend && - CHARMATCH_EXPR(CHARREF(patinput, patinend), - nextch))) { - if (patmatch(next)) - return 1; + if (no >= min) { + for (;;) { + int charmatch_cache; + if (nextch < 0 || + (patinput < patinend && + CHARMATCH_EXPR(CHARREF(patinput, patinend), + nextch))) { + if (patmatch(next)) + return 1; + } + if (--no < min) + break; + /* find start of previous full character */ + while (!*--lastcharstart) + DPUTS(lastcharstart < charstart, + "lastcharstart invalid"); + patinput = start + (lastcharstart-charstart); + patglobflags = savglobflags; + errsfound = saverrsfound; } - no--; - /* find start of previous full character */ - while (!*--lastcharstart) - ; - patinput = start + (lastcharstart-charstart); - patglobflags = savglobflags; - errsfound = saverrsfound; } } /* -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php