From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1940 invoked from network); 16 Mar 2005 11:14:18 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 16 Mar 2005 11:14:18 -0000 Received: (qmail 36804 invoked from network); 16 Mar 2005 11:14:11 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 16 Mar 2005 11:14:11 -0000 Received: (qmail 15715 invoked by alias); 16 Mar 2005 11:14:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20983 Received: (qmail 15698 invoked from network); 16 Mar 2005 11:14:05 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 16 Mar 2005 11:14:05 -0000 Received: (qmail 36504 invoked from network); 16 Mar 2005 11:14:05 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 16 Mar 2005 11:13:54 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id ; Wed, 16 Mar 2005 11:12:20 +0000 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 16 Mar 2005 11:15:41 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j2GBDoMc009530; Wed, 16 Mar 2005 11:13:52 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j2GBDnAk009527; Wed, 16 Mar 2005 11:13:50 GMT Message-Id: <200503161113.j2GBDnAk009527@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Kobayashi Noritada , zsh-workers@sunsite.dk Subject: Re: Globbing for directory names with two '='-s fail after 4.2.2. In-reply-to: <20050316.165718.71117897.nori1@dolphin.c.u-tokyo.ac.jp> References: <20050316.165718.71117897.nori1@dolphin.c.u-tokyo.ac.jp> Date: Wed, 16 Mar 2005 11:13:49 +0000 From: Peter Stephenson X-OriginalArrivalTime: 16 Mar 2005 11:15:41.0319 (UTC) FILETIME=[7D365970:01C52A19] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.5 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.5 Kobayashi Noritada wrote: > Hi, > > Globbing for directory names with two '='-s sometimes fails > (i.e. wildcards '*' and '?' don't work) with Zsh after 4.2.2. > It seems to be related to changes in Src/{glob.c,pattern.c} on 2004-10-18. Thanks for noticing. Could you try the following patch and see if it fixes all the problems you are seeing? The problem was that a string was no longer null-terminated in the case that it was examined by the pattern matcher, but found to contain no patterns. I will commit this on both branches and some time around (western-style) Easter we should probably produce 4.2.5. There may be other patches to transfer. Index: Src/glob.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/glob.c,v retrieving revision 1.38 diff -u -r1.38 glob.c --- Src/glob.c 10 Jan 2005 17:31:19 -0000 1.38 +++ Src/glob.c 16 Mar 2005 11:12:12 -0000 @@ -223,13 +223,14 @@ /**/ static void -addpath(char *s) +addpath(char *s, int l) { DPUTS(!pathbuf, "BUG: pathbuf not initialised"); - while (pathpos + (int) strlen(s) + 1 >= pathbufsz) + while (pathpos + l + 1 >= pathbufsz) pathbuf = realloc(pathbuf, pathbufsz *= 2); - while ((pathbuf[pathpos++] = *s++)); - pathbuf[pathpos - 1] = '/'; + while (l--) + pathbuf[pathpos++] = *s++; + pathbuf[pathpos++] = '/'; pathbuf[pathpos] = '\0'; } @@ -504,14 +505,17 @@ } } if (add) { - addpath(str); + addpath(str, l); if (!closure || !statfullpath("", NULL, 1)) scanner((q->closure) ? q : q->next); pathbuf[pathpos = oppos] = '\0'; } } - } else + } else { + if (str[l]) + str = dupstrpfx(str, l); insert(str, 0); + } } else { /* Do pattern matching on current path section. */ char *fn = pathbuf[pathbufcwd] ? unmeta(pathbuf + pathbufcwd) : "."; @@ -608,8 +612,9 @@ int oppos = pathpos; for (fn = subdirs; fn < subdirs+subdirlen; ) { - addpath(fn); - fn += strlen(fn) + 1; + int l = strlen(fn); + addpath(fn, l); + fn += l + 1; memcpy((char *)&errsfound, fn, sizeof(int)); fn += sizeof(int); scanner((q->closure) ? q : q->next); /* scan next level */ Index: Test/D02glob.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/D02glob.ztst,v retrieving revision 1.8 diff -u -r1.8 D02glob.ztst --- Test/D02glob.ztst 26 Oct 2004 17:20:29 -0000 1.8 +++ Test/D02glob.ztst 16 Mar 2005 11:12:12 -0000 @@ -317,3 +317,9 @@ print ${foo%% #:*} 0:Must-match arguments in complex patterns >this string has a + + mkdir glob.tmp/ra=1.0_et=3.5 + touch glob.tmp/ra=1.0_et=3.5/foo + print glob.tmp/ra=1.0_et=3.5/??? +0:Bug with intermediate paths with plain strings but tokenized characters +>glob.tmp/ra=1.0_et=3.5/foo -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************