Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: core dump or infinite loop in brace expansion
- X-seq: zsh-workers 32767
- From: "Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: core dump or infinite loop in brace expansion
- Date: Wed, 11 Jun 2014 18:46:58 +0900
- In-reply-to: <CAH+w=7YzAGDxDDuPEQDyJ3CJR6oy_d3e4JzdJYXRL8Yn5n0SYw@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: <326B6455-7737-4D1D-8AB9-D37156E00347@kba.biglobe.ne.jp> <CAH+w=7YzAGDxDDuPEQDyJ3CJR6oy_d3e4JzdJYXRL8Yn5n0SYw@mail.gmail.com>
On 2014/06/11, at 10:05, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Seems like the right thing would be to make bracechardots() agree with
> xpandbraces().
Thanks. With a few more testing, I've found that we need to take care
of the 'cend' part also:
zsh% print -r {x..{}
glob.c:2180: BUG: unmatched brace in xpandbraces()
x y z {
I also tested with other "special" characters '}', ',' and '.',
but didn't find any problem:
zsh% print -r {\}..~}
} ~
zsh% print -r {}..~}
zsh: parse error near `}'
zsh% print -r {...2} # {\...2} gives the same result
. / 0 1 2
zsh% print -r {#...}
# $ % & ' ( ) * + , - .
zsh% print -r {...,}
...
zsh% print -r {...\,}
. - ,
diff --git a/Src/glob.c b/Src/glob.c
index 15a5f70..3ae364c 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2122,6 +2122,8 @@ bracechardots(char *str, convchar_t *c1p, convchar_t *c2p)
convchar_t cstart, cend;
char *pnext = str + 1, *pconv, convstr[2];
if (itok(*pnext)) {
+ if (*pnext == Inbrace)
+ return 0;
convstr[0] = ztokens[*pnext - Pound];
convstr[1] = '\0';
pconv = convstr;
@@ -2133,6 +2135,8 @@ bracechardots(char *str, convchar_t *c1p, convchar_t *c2p)
return 0;
pnext += 2;
if (itok(*pnext)) {
+ if (*pnext == Inbrace)
+ return 0;
convstr[0] = ztokens[*pnext - Pound];
convstr[1] = '\0';
pconv = convstr;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author