From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16032 invoked from network); 1 Apr 2005 20:07:11 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Apr 2005 20:07:11 -0000 Received: (qmail 83504 invoked from network); 1 Apr 2005 20:07:03 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Apr 2005 20:07:03 -0000 Received: (qmail 11639 invoked by alias); 1 Apr 2005 20:06:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21082 Received: (qmail 11620 invoked from network); 1 Apr 2005 20:06:57 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Apr 2005 20:06:57 -0000 Received: (qmail 83196 invoked from network); 1 Apr 2005 20:06:57 -0000 Received: from dan.emsphone.com (199.67.51.101) by a.mx.sunsite.dk with SMTP; 1 Apr 2005 20:06:52 -0000 Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j31K6glr083722; Fri, 1 Apr 2005 14:06:42 -0600 (CST) (envelope-from dan) Date: Fri, 1 Apr 2005 14:06:42 -0600 From: Dan Nelson To: Peter Stephenson Cc: zsh-workers@sunsite.dk Subject: Re: Parse errors don't cause a non-zero exit code? Message-ID: <20050401200642.GC4564@dan.emsphone.com> References: <20050329231719.GH51674@dan.emsphone.com> <20050331171421.GG46288@dan.emsphone.com> <200504011007.j31A7MU2029290@news01.csr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200504011007.j31A7MU2029290@news01.csr.com> X-OS: FreeBSD 5.4-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.8i X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 In the last episode (Apr 01), Peter Stephenson said: > Dan Nelson wrote: > > In the last episode (Mar 29), Dan Nelson said: > > > $ echo "'" > /tmp/test ; zsh -f /tmp/test ; echo $? > > > /tmp/test:2: unmatched ' > > > 0 > > I came up with this. It uses the LEXERR to signal the error rather > than propagating errflag. > > I found there was another case which still didn't return non-zero > status, when the same code came from stdin. That needed handling at > the next level down. There's a third case: input passed via -c. Possible fix and testcase. Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.85 diff -u -p -r1.85 exec.c --- Src/exec.c 31 Mar 2005 09:54:59 -0000 1.85 +++ Src/exec.c 1 Apr 2005 19:56:59 -0000 @@ -162,6 +162,8 @@ parse_string(char *s) lineno = 1; p = parse_list(); lineno = oldlineno; + if (tok == LEXERR && !lastval) + lastval = 1; strinend(); inpop(); lexrestore(); Index: Test/A01grammar.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/A01grammar.ztst,v retrieving revision 1.10 diff -u -p -r1.10 A01grammar.ztst --- Test/A01grammar.ztst 1 Apr 2005 10:17:25 -0000 1.10 +++ Test/A01grammar.ztst 1 Apr 2005 19:56:59 -0000 @@ -448,3 +448,7 @@ $ZTST_testdir/../Src/zsh -f