Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh bug in . builtin
- X-seq: zsh-workers 27087
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: zsh bug in . builtin
- Date: Thu, 2 Jul 2009 14:40:15 +0100
- In-reply-to: <loom.20090702T115609-92@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <4A4B614E.7000406@xxxxxxx> <20090701152420.2beb1c78@news01> <loom.20090702T115609-92@xxxxxxxxxxxxxx>
On Thu, 2 Jul 2009 12:01:11 +0000 (UTC)
Eric Blake <ebb9@xxxxxxx> wrote:
> Peter Stephenson <pws <at> 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 <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author