Currently dash uses exit status 2 to report failure to run a
script named on the command line that does not exist:
$ sh nonexistent
sh: Can't open nonexistent
$ echo $?
2
According to SUSv3 and SUSv4[1], the exit code should be 127.
So check errno when opening a command_file during argument
open() succeeds, though read() fails later, when a pathname
passed as argv[0] on the command line points to a directory,
which somehow results in dash thinking everything is okay:
$ sh dir/
$ echo $?
0
But POSIX makes it clear enough that in sh command_file,
command_file is supposed to be a
Herbert Xu wrote:
On Wed, Oct 06, 2010 at 05:08:04AM -0500, Jonathan Nieder wrote:
But POSIX makes it clear enough that in sh command_file,
command_file is supposed to be a file, not a directory. So
diagnose this with an error message and exit with status 2.
[...]
Is this required by POSIX?
On 10/06/2010 04:55 AM, Jonathan Nieder wrote:
But POSIX makes it clear enough that in sh command_file,
command_file is supposed to be a file, not a directory. So
diagnose this with an error message and exit with status 2.
[...]
Is this required by POSIX? If not this is simply making dash
On Wed, Oct 06, 2010 at 06:18:05AM -0600, Eric Blake wrote:
Right now, dash gets this wrong:
dash -c 'exec .'; echo $?
exec: 1: /: Permission denied
2
And since you already have the code in dash to detect failure to 'exec'
a directory, you should be able to reuse that code when
Eric Blake wrote:
Additionally, the standard REQUIRES that 'sh -c exec /' shall fail
with status 126:
http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#exec
If command is found, but it is not an executable utility, the exit
status shall be 126.
Right now, dash gets
At some point between ash 0.3.5-11.0.1 and ash 0.3.8-37, Debian
ash stopped using the EXSHELLPROC exception to handle shell
scripts without a magic number.
Remove all remaining references to it to avoid confusion.
Signed-off-by: Jonathan Nieder jrnie...@gmail.com
---
src/TOUR| 11
This reverts commit c0e07c010e5abdea1a7d1357edb1d08adac529cb.
Yes, it is nicer to pass the exit status through the exitstatus
global, but look at the consequences:
$ sh -c 'exec nonexistent'; echo $?
exec: 1: nonexistent: not found
2
$ sh -c 'exec .'; echo $?
exec: 1: .: Permission denied
On Wed, Oct 06, 2010 at 08:04:58PM -0500, Jonathan Nieder wrote:
This reverts commit c0e07c010e5abdea1a7d1357edb1d08adac529cb.
Yes, it is nicer to pass the exit status through the exitstatus
global, but look at the consequences:
$ sh -c 'exec nonexistent'; echo $?
exec: 1: nonexistent:
On Wed, Oct 06, 2010 at 08:08:07PM -0500, Jonathan Nieder wrote:
Pass the exit status from the exec builtin through the exitstatus
global. This just eliminates a global variable; no noticeable
change is intended.
Based on v0.5.3~57 (Eliminated global exerrno, 2005-02-25).
Signed-off-by:
On Wed, Oct 06, 2010 at 08:03:47PM -0500, Jonathan Nieder wrote:
diff --git a/src/error.h b/src/error.h
index 3162e15..15ccbe3 100644
--- a/src/error.h
+++ b/src/error.h
@@ -66,9 +66,8 @@ extern int exception;
/* exceptions */
#define EXINT 0 /* SIGINT received */
#define
Herbert Xu wrote:
On Wed, Oct 06, 2010 at 08:03:47PM -0500, Jonathan Nieder wrote:
--- a/src/error.h
+++ b/src/error.h
@@ -66,9 +66,8 @@ extern int exception;
/* exceptions */
#define EXINT 0 /* SIGINT received */
#define EXERROR 1 /* a generic error */
-#define
On Wed, Oct 06, 2010 at 10:04:14PM -0500, Jonathan Nieder wrote:
Herbert Xu wrote:
On Wed, Oct 06, 2010 at 08:03:47PM -0500, Jonathan Nieder wrote:
--- a/src/error.h
+++ b/src/error.h
@@ -66,9 +66,8 @@ extern int exception;
/* exceptions */
#define EXINT 0 /* SIGINT
Herbert Xu wrote:
Actually the bug is elsewhere.
It does bisect to there. :) But you're right, it would have been
simpler to send one patch.
--- a/src/eval.c
+++ b/src/eval.c
@@ -854,7 +854,7 @@ bail:
int i;
i = exception;
-
At some point between ash 0.3.5-11.0.1 and ash 0.3.8-37, Debian
ash stopped using the EXSHELLPROC exception to handle shell
scripts without a magic number.
Remove all remaining references to it to avoid confusion.
Signed-off-by: Jonathan Nieder jrnie...@gmail.com
---
Herbert Xu wrote:
Yeah
On Wed, Oct 06, 2010 at 10:35:18PM -0500, Jonathan Nieder wrote:
Herbert Xu wrote:
Actually the bug is elsewhere.
It does bisect to there. :) But you're right, it would have been
simpler to send one patch.
--- a/src/eval.c
+++ b/src/eval.c
@@ -854,7 +854,7 @@ bail:
On Thu, Oct 07, 2010 at 12:14:06PM +0800, Herbert Xu wrote:
Let me run it through the tests and apply it.
There is one problem with this and that is changing the exit
status in a trap:
sh -c 'trap exec nosuchfile EXIT; exit 3'; echo $?
This makes dash exit with 127 instead of 3 as it
17 matches
Mail list logo