From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7329 invoked from network); 19 Jul 1999 08:40:52 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 19 Jul 1999 08:40:52 -0000 Received: (qmail 16907 invoked by alias); 19 Jul 1999 08:40:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7192 Received: (qmail 16900 invoked from network); 19 Jul 1999 08:40:39 -0000 Message-Id: <9907190809.AA35966@ibmth.df.unipi.it> To: zsh-workers@sunsite.auc.dk Subject: Re: The pattern containing NUL. In-Reply-To: "Tanaka Akira"'s message of "19 Jul 1999 13:38:43 DFT." Date: Mon, 19 Jul 1999 10:09:42 +0200 From: Peter Stephenson Tanaka Akira wrote: > zsh-3.1.6-test-1 dumps core as following on NetBSD 1.4. > > Z(2):akr@localhost% Src/zsh -f > localhost% print $OSTYPE > netbsd1.4 > localhost% print $ZSH_VERSION > 3.1.6-test-1 > localhost% tmp=a > localhost% print "${line#$'\0'}" > zsh: segmentation fault (core dumped) Src/zsh -f > Z(2):akr@localhost% > > The backtrace was follows. Well, I can't get the core dump and don't entirely believe the backtrace, but there does seem to be a bug... does this fix it? We really need a pattern matching expert to fix up the globbing code. It's slow and complicated (all right, it would look out of place if wasn't). --- Src/glob.c.null Sun Jul 18 17:37:35 1999 +++ Src/glob.c Mon Jul 19 10:03:42 1999 @@ -2724,6 +2724,9 @@ * Here we bypass tulower() and tuupper() for speed. */ int xi = (STOUC(UNMETA(x)) & 0xff), yi = (STOUC(UNMETA(y)) & 0xff); + /* A NULL is a real null, since a \000 would be metafied. */ + if (!*x || !*y) + return 0; return xi == yi || (((c->stat & C_IGNCASE) ? ((isupper(xi) ? tolower(xi) : xi) == -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy