From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23057 invoked from network); 2 Jul 2009 13:40:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 2 Jul 2009 13:40:44 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 77538 invoked from network); 2 Jul 2009 13:40:34 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Jul 2009 13:40:34 -0000 Received: (qmail 15844 invoked by alias); 2 Jul 2009 13:40:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27087 Received: (qmail 15827 invoked from network); 2 Jul 2009 13:40:24 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 2 Jul 2009 13:40:24 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [85.115.60.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 2A57E803080A for ; Thu, 2 Jul 2009 15:40:21 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly13d.srv.mailcontrol.com (MailControl) with ESMTP id n62DeJsO017644 for ; Thu, 2 Jul 2009 14:40:19 +0100 Received: from news01 ([10.99.50.25]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 2 Jul 2009 14:40:15 +0100 Date: Thu, 2 Jul 2009 14:40:15 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: zsh bug in . builtin Message-ID: <20090702144015.299cd1c6@news01> In-Reply-To: References: <4A4B614E.7000406@byu.net> <20090701152420.2beb1c78@news01> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Jul 2009 13:40:15.0645 (UTC) FILETIME=[A1A534D0:01C9FB1A] X-Scanned-By: MailControl A-09-20-00 (www.mailcontrol.com) on 10.68.0.123 X-Virus-Scanned: ClamAV 0.94.2/9535/Thu Jul 2 10:57:25 2009 on bifrost X-Virus-Status: Clean On Thu, 2 Jul 2009 12:01:11 +0000 (UTC) Eric Blake wrote: > Peter Stephenson csr.com> writes: > > > Those are all bugs; it's not supposed to ignore errors even in native mode. > > I've taken 128 to mean failed to execute file, 129 to mean failed to find > > file---anyone can suggest better values if unhappy. > > I'd much prefer 127 for a missing file (similar to exec), and something < 127 > for syntax error (128 and above should typically be for signals). That seems reasonable. Index: Doc/Zsh/builtins.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v retrieving revision 1.122 diff -u -r1.122 builtins.yo --- Doc/Zsh/builtins.yo 1 Jul 2009 15:07:32 -0000 1.122 +++ Doc/Zsh/builtins.yo 2 Jul 2009 13:00:31 -0000 @@ -46,8 +46,8 @@ If any arguments var(arg) are given, they become the positional parameters; the old positional parameters are restored when the var(file) is done executing. -If var(file) was not found the return status is 129; if var(file) was found -but contained a syntax error the return status is 128; else the return +If var(file) was not found the return status is 127; if var(file) was found +but contained a syntax error the return status is 126; else the return status is the exit status of the last command executed. ) findex(NOTRANS(:)) Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.229 diff -u -r1.229 builtin.c --- Src/builtin.c 1 Jul 2009 15:07:32 -0000 1.229 +++ Src/builtin.c 2 Jul 2009 13:00:31 -0000 @@ -4773,7 +4773,7 @@ zsfree(arg0); if (old0) argzero = old0; - return ret == SOURCE_OK ? lastval : 127 + ret; + return ret == SOURCE_OK ? lastval : 128 - ret; } /* Index: Src/zsh.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v retrieving revision 1.157 diff -u -r1.157 zsh.h --- Src/zsh.h 1 Jul 2009 15:07:33 -0000 1.157 +++ Src/zsh.h 2 Jul 2009 13:00:31 -0000 @@ -1730,10 +1730,10 @@ enum source_return { /* Source ran OK */ SOURCE_OK = 0, - /* Internal error sourcing file */ - SOURCE_ERROR = 1, /* File not found */ - SOURCE_NOT_FOUND = 2 + SOURCE_NOT_FOUND = 1, + /* Internal error sourcing file */ + SOURCE_ERROR = 2 }; /***********************************/ Index: Test/A01grammar.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/A01grammar.ztst,v retrieving revision 1.20 diff -u -r1.20 A01grammar.ztst --- Test/A01grammar.ztst 1 Jul 2009 15:07:33 -0000 1.20 +++ Test/A01grammar.ztst 2 Jul 2009 13:00:31 -0000 @@ -515,10 +515,10 @@ >not#comment . ./nonexistent -129: Attempt to "." non-existent file. +127: Attempt to "." non-existent file. ?(eval):.:1: no such file or directory: ./nonexistent echo '[[' >bad_syntax . ./bad_syntax -128: Attempt to "." file with bad syntax. +126: Attempt to "." file with bad syntax. ?./bad_syntax:2: parse error near `\n' -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070