Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Command line bug since zsh 3.1.7...
- X-seq: zsh-workers 20418
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Command line bug since zsh 3.1.7...
- Date: Wed, 29 Sep 2004 21:16:03 -0700 (PDT)
- In-reply-to: <Pine.LNX.4.61.0409292052590.3955@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <BAY2-F2825q8awYFDIf0000af93@xxxxxxxxxxx> <Pine.LNX.4.61.0409292052590.3955@xxxxxxxxxxxxxxxxxx>
- Reply-to: zsh-workers@xxxxxxxxxx
On Wed, 29 Sep 2004, Bart Schaefer wrote:
> On Wed, 29 Sep 2004, Sebastian Rasmussen wrote:
>
> > hal9000% zsh -c 'echo bar |'
> > zsh: segmentation fault zsh -c 'echo bar |'
>
> Seems to be this easy
The following might be a more palatable fix, as it produces a parse error
rather than silently treating the '|' as a ';'. This is still not the
same as bash (which says "unexpected end of file") but arguably "syntax
error near `|'" is a more helpful error anyway.
There are still other cases where zsh doesn't crash, but doesn't produce
an error either. E.g. (even without the following patch):
schaefer[643] bash -c 'echo |{;}'
bash: syntax error near unexpected token `;}'
bash: -c: line 1: `echo |{;}'
schaefer[644] Src/zsh -fc 'echo |{;}'
schaefer[645]
(Perhaps the patch should set tok = LEXERR only when tok == ENDINPUT ?
I couldn't decide.)
Index: Src/parse.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/parse.c,v
retrieving revision 1.20
diff -c -r1.20 parse.c
--- parse.c 14 Aug 2004 05:01:23 -0000 1.20
+++ parse.c 30 Sep 2004 04:01:06 -0000
@@ -729,7 +729,9 @@
ecbuf[p] = WCB_PIPE(WC_PIPE_MID, (line >= 0 ? line + 1 : 0));
ecispace(p + 1, 1);
ecbuf[p + 1] = ecused - 1 - p;
- par_pline(complex);
+ if (!par_pline(complex)) {
+ tok = LEXERR;
+ }
cmdpop();
return 1;
} else if (tok == BARAMP) {
@@ -750,7 +752,9 @@
ecbuf[p] = WCB_PIPE(WC_PIPE_MID, (line >= 0 ? line + 1 : 0));
ecispace(p + 1, 1);
ecbuf[p + 1] = ecused - 1 - p;
- par_pline(complex);
+ if (!par_pline(complex)) {
+ tok = LEXERR;
+ }
cmdpop();
return 1;
} else {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author