Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: extendedglob recursion (/)#
- X-seq: zsh-workers 34635
 
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
 
- To: Zsh hackers list <zsh-workers@xxxxxxx>
 
- Subject: Re: extendedglob recursion (/)#
 
- Date: Thu, 26 Feb 2015 08:52:38 -0800
 
- In-reply-to: <CAH+w=7YRrikb7Ydwze+2Rq88nzOmvqynmG_N5Zbjc7PVZLm9Ag@mail.gmail.com>
 
- List-help: <mailto:zsh-workers-help@zsh.org>
 
- List-id: Zsh Workers List <zsh-workers.zsh.org>
 
- List-post: <mailto:zsh-workers@zsh.org>
 
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
 
- References: <54EE6DFF.7010901@gmx.com> 	<CAH+w=7YRrikb7Ydwze+2Rq88nzOmvqynmG_N5Zbjc7PVZLm9Ag@mail.gmail.com>
 
On Feb 25,  8:56pm, Bart Schaefer wrote:
}
} +        /* special case (/)# to avoid infinite recursion */
} +        l1->closure = (p1->patmlen > 0) ? 1 + pdflag : 0;
Sorry, that's not correct.  patmlen can be zero in cases other than (/).
diff --git a/Src/glob.c b/Src/glob.c
index 82f8d62..33facde 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -708,7 +708,8 @@ parsecomplist(char *instr)
 	    }
 	    l1 = (Complist) zhalloc(sizeof *l1);
 	    l1->pat = p1;
-	    l1->closure = 1 + pdflag;
+	    /* special case (/)# to avoid infinite recursion */
+	    l1->closure = (*((char *)p1 + p1->startoff)) ? 1 + pdflag : 0;
 	    l1->follow = 0;
 	    l1->next = parsecomplist(instr);
 	    return (l1->pat) ? l1 : NULL;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author