From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25379 invoked from network); 19 Feb 2003 18:15:19 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Feb 2003 18:15:19 -0000 Received: (qmail 10991 invoked by alias); 19 Feb 2003 18:14:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18263 Received: (qmail 10976 invoked from network); 19 Feb 2003 18:14:54 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 19 Feb 2003 18:14:54 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.147] by sunsite.dk (MessageWall 1.0.8) with SMTP; 19 Feb 2003 18:14:53 -0000 X-VirusChecked: Checked X-Env-Sender: kiddleo@logica.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1045678366!4305 Received: (qmail 5960 invoked from network); 19 Feb 2003 18:12:46 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-6.tower-27.messagelabs.com with SMTP; 19 Feb 2003 18:12:46 -0000 Received: from finches.logica.co.uk ([158.234.142.11]) by iris.logica.co.uk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id SAA17667 for ; Wed, 19 Feb 2003 18:14:54 GMT X-Authentication-Warning: iris.logica.co.uk: Host [158.234.142.11] claimed to be finches.logica.co.uk Received: from finches.logica.co.uk (localhost [127.0.0.1]) by finches.logica.co.uk (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h1JIIPg29354 for ; Wed, 19 Feb 2003 19:18:25 +0100 To: zsh-workers@sunsite.dk In-reply-to: <6305.1040317499@finches.logica.co.uk> From: Oliver Kiddle References: <6134254DE87BD411908B00A0C99B044F03A0B5AC@MOWD019A> <4575.1040299586@finches.logica.co.uk> <6134254DE87BD411908B00A0C99B044F03A0B5B3@MOWD019A> <1021219161025.ZM4820@candle.brasslantern.com> <6305.1040317499@finches.logica.co.uk> Subject: PATCH: fix problem with globs inside (e) glob qualifier Date: Wed, 19 Feb 2003 19:18:25 +0100 Message-ID: <29352.1045678705@finches.logica.co.uk> Sender: kiddleo@logica.com On 19 Dec, I wrote: > > I've just checked again and it does crash 4.0.2. It just takes a few > runs, depending on the files in the current directory as it is doing > globbing. > : *(e:'a=( * )':) > seems to be sufficient. I suppose the filename generation code doesn't > like being called recursively. glob.c does contain code for saving and restoring it's state but it was broken in a couple of places. First after saving pathbuf, the saved copy was set to null. Then, in one place the values were not restored. There may be other problems still there due to the save function not reinitialising all the variables. Oliver Index: glob.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/glob.c,v retrieving revision 1.28 diff -u -r1.28 glob.c --- glob.c 5 Aug 2002 12:35:59 -0000 1.28 +++ glob.c 19 Feb 2003 18:09:55 -0000 @@ -181,9 +181,9 @@ (N).gd_pathpos = pathpos; \ (N).gd_pathbuf = pathbuf; \ (N).gd_pathbufsz = 0; \ - (N).gd_pathbuf = NULL; \ (N).gd_glob_pre = glob_pre; \ (N).gd_glob_suf = glob_suf; \ + pathbuf = NULL; \ } while (0) #define restore_globstate(N) \ @@ -234,7 +234,7 @@ } /* stat the filename s appended to pathbuf. l should be true for lstat, * - * false for stat. If st is NULL, the file is only chechked for existance. * + * false for stat. If st is NULL, the file is only checked for existance. * * s == "" is treated as s == ".". This is necessary since on most systems * * foo/ can be used to reference a non-directory foo. Returns nonzero if * * the file does not exists. */ @@ -1580,6 +1580,7 @@ } else if (isset(NOMATCH)) { zerr("no matches found: %s", ostr, 0); free(matchbuf); + restore_globstate(saved); return; } else { /* treat as an ordinary string */ This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.