From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19635 invoked from network); 8 Jun 2005 13:54:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 8 Jun 2005 13:54:27 -0000 Received: (qmail 71147 invoked from network); 8 Jun 2005 13:54:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 8 Jun 2005 13:54:22 -0000 Received: (qmail 28757 invoked by alias); 8 Jun 2005 13:54:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21317 Received: (qmail 28748 invoked from network); 8 Jun 2005 13:54:19 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 8 Jun 2005 13:54:19 -0000 Received: (qmail 70831 invoked from network); 8 Jun 2005 13:54:19 -0000 Received: from cluster-e.mailcontrol.com (HELO rly13e.srv.mailcontrol.com) (217.79.216.190) by a.mx.sunsite.dk with SMTP; 8 Jun 2005 13:54:07 -0000 Received: from iris.logica.co.uk (iris.logica.co.uk [158.234.9.163]) by rly13e.srv.mailcontrol.com (MailControl) with ESMTP id j58Ds4OG009396 for ; Wed, 8 Jun 2005 14:54:04 +0100 Received: from trentino.logica.co.uk ([158.234.142.59]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id j58Ds3KM017544 for ; Wed, 8 Jun 2005 14:54:03 +0100 Received: from trentino.groupinfra.com (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id 4FE376BC0E for ; Wed, 8 Jun 2005 15:53:58 +0200 (CEST) X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- From: Oliver Kiddle To: Zsh workers Subject: PATCH: recursive globs with e qualifier hangs the shell Date: Wed, 08 Jun 2005 15:53:56 +0200 Message-ID: <26912.1118238836@trentino.groupinfra.com> X-Scanned-By: MailControl A-05-01-01 (www.mailcontrol.com) 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 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.