zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@sunsite.dk
Subject: PATCH: fix problem with globs inside (e) glob qualifier
Date: Wed, 19 Feb 2003 19:18:25 +0100	[thread overview]
Message-ID: <29352.1045678705@finches.logica.co.uk> (raw)
In-Reply-To: <6305.1040317499@finches.logica.co.uk>

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.


      reply	other threads:[~2003-02-19 18:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6134254DE87BD411908B00A0C99B044F03A0B5AC@MOWD019A>
2002-12-19 12:06 ` Dynamically adding to $mailpath? Oliver Kiddle
2002-12-19 12:44   ` Borzenkov Andrey
2002-12-19 16:10     ` Bart Schaefer
2002-12-19 17:04       ` Oliver Kiddle
2003-02-19 18:18         ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29352.1045678705@finches.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).