zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@sunsite.dk>
Subject: PATCH: recursive globs with e qualifier hangs the shell
Date: Wed, 08 Jun 2005 15:53:56 +0200	[thread overview]
Message-ID: <26912.1118238836@trentino.groupinfra.com> (raw)

To reproduce, you can use something like this:
  print **/*(e:print **/*:)

It hangs because addpath in glob.c is called with pathbufsz zero. It
then goes into a while loop doing pathbufsz *= 2, never exiting because
pathbufsz never increases.

It is set to zero in save_globstate which seems like a strange thing to
do. Surely it should save the actual value instead of zero. Perhaps the
original intention was to set pathbufsz instead of (N).gd_pathbufsz to
zero. The patch below appears to fix it and I can't see any problem with
it. This isn't the first time we've had problems with that glob state
saving and I suspect it won't be the last. I've also included a test.

Oliver

Index: Src/glob.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/glob.c,v
retrieving revision 1.41
diff -u -r1.41 glob.c
--- Src/glob.c  24 Apr 2005 18:38:38 -0000      1.41
+++ Src/glob.c  8 Jun 2005 13:28:33 -0000
@@ -180,7 +180,6 @@
     memcpy(&(N), &curglobdata, sizeof(struct globdata)); \
     (N).gd_pathpos = pathpos; \
     (N).gd_pathbuf = pathbuf; \
-    (N).gd_pathbufsz = 0; \
     (N).gd_glob_pre = glob_pre; \
     (N).gd_glob_suf = glob_suf; \
     pathbuf = NULL; \
Index: Test/D02glob.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D02glob.ztst,v
retrieving revision 1.10
diff -u -r1.10 D02glob.ztst
--- Test/D02glob.ztst   9 May 2005 10:46:15 -0000       1.10
+++ Test/D02glob.ztst   8 Jun 2005 13:28:33 -0000
@@ -280,6 +280,10 @@
 0:Globbing used recursively (inside e glob qualifier)
 >a a b b c c
 
+ print glob.tmp/*/*(e:'reply=( glob.tmp/**/*([1]) )'::t)
+0:Recursive globbing used recursively (inside e glob qualifier)
+>a a a a a a a
+
  print glob.tmp/**/(:h) 
 0:Head modifier
 >. glob.tmp glob.tmp glob.tmp glob.tmp glob.tmp/dir3


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:[~2005-06-08 13:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=26912.1118238836@trentino.groupinfra.com \
    --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).