From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17207 invoked from network); 30 Sep 2004 04:17:25 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 30 Sep 2004 04:17:25 -0000 Received: (qmail 70154 invoked from network); 30 Sep 2004 04:17:19 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Sep 2004 04:17:19 -0000 Received: (qmail 113 invoked by alias); 30 Sep 2004 04:17:07 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20418 Received: (qmail 88 invoked from network); 30 Sep 2004 04:17:06 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 30 Sep 2004 04:17:06 -0000 Received: (qmail 69701 invoked from network); 30 Sep 2004 04:16:07 -0000 Received: from moonbase.zanshin.com (64.84.47.139) by a.mx.sunsite.dk with SMTP; 30 Sep 2004 04:16:04 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.13.1/8.13.1) with ESMTP id i8U4G3DJ031909 for ; Wed, 29 Sep 2004 21:16:03 -0700 Date: Wed, 29 Sep 2004 21:16:03 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-workers@sunsite.dk To: zsh-workers@sunsite.dk Subject: Re: Command line bug since zsh 3.1.7... In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 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 {