* [PATCH 1/2] [INPUT] exit 127 if command_file is given but does not exist
@ 2009-09-29 11:15 Gerrit Pape
2010-03-19 16:20 ` Gerrit Pape
0 siblings, 1 reply; 2+ messages in thread
From: Gerrit Pape @ 2009-09-29 11:15 UTC (permalink / raw)
To: dash
This commit makes dash exit with return code 127 instead of 2 if
started as non-interactive shell with a non-existent command_file
specified as argument, as documented in
http://www.opengroup.org/onlinepubs/009695399/utilities/sh.html#tag_04_128_14
The wrong exit code was reported by Clint Adams through
http://bugs.debian.org/548743
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
src/input.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/input.c b/src/input.c
index e57ad76..c1e3e54 100644
--- a/src/input.c
+++ b/src/input.c
@@ -101,6 +101,7 @@ MKINIT struct parsefile basepf; /* top level input file */
MKINIT char basebuf[IBUFSIZ]; /* buffer for top level input file */
struct parsefile *parsefile = &basepf; /* current input file */
int whichprompt; /* 1 == PS1, 2 == PS2 */
+extern int exitstatus;
#ifndef SMALL
EditLine *el; /* cookie for editline package */
@@ -408,7 +409,9 @@ setinputfile(const char *fname, int flags)
if ((fd = open(fname, O_RDONLY)) < 0) {
if (flags & INPUT_NOFILE_OK)
goto out;
- sh_error("Can't open %s", fname);
+ sh_warnx("Can't open %s", fname);
+ exitstatus = 127;
+ exraise(EXEXIT);
}
if (fd < 10)
fd = savefd(fd, fd);
--
1.6.0.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] [INPUT] exit 127 if command_file is given but does not exist
2009-09-29 11:15 [PATCH 1/2] [INPUT] exit 127 if command_file is given but does not exist Gerrit Pape
@ 2010-03-19 16:20 ` Gerrit Pape
0 siblings, 0 replies; 2+ messages in thread
From: Gerrit Pape @ 2010-03-19 16:20 UTC (permalink / raw)
To: dash
Hi Herbert,
if you find some spare time, can you please take a look at these
patches, and see whether they're suitable for master?
http://article.gmane.org/gmane.comp.shells.dash/198
http://article.gmane.org/gmane.comp.shells.dash/199
http://article.gmane.org/gmane.comp.shells.dash/200
http://article.gmane.org/gmane.comp.shells.dash/201
http://article.gmane.org/gmane.comp.shells.dash/196
Thanks, Gerrit.
On Tue, Sep 29, 2009 at 11:15:55AM +0000, Gerrit Pape wrote:
> This commit makes dash exit with return code 127 instead of 2 if
> started as non-interactive shell with a non-existent command_file
> specified as argument, as documented in
> http://www.opengroup.org/onlinepubs/009695399/utilities/sh.html#tag_04_128_14
>
> The wrong exit code was reported by Clint Adams through
> http://bugs.debian.org/548743
>
> Signed-off-by: Gerrit Pape <pape@smarden.org>
> ---
> src/input.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/src/input.c b/src/input.c
> index e57ad76..c1e3e54 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -101,6 +101,7 @@ MKINIT struct parsefile basepf; /* top level input file */
> MKINIT char basebuf[IBUFSIZ]; /* buffer for top level input file */
> struct parsefile *parsefile = &basepf; /* current input file */
> int whichprompt; /* 1 == PS1, 2 == PS2 */
> +extern int exitstatus;
>
> #ifndef SMALL
> EditLine *el; /* cookie for editline package */
> @@ -408,7 +409,9 @@ setinputfile(const char *fname, int flags)
> if ((fd = open(fname, O_RDONLY)) < 0) {
> if (flags & INPUT_NOFILE_OK)
> goto out;
> - sh_error("Can't open %s", fname);
> + sh_warnx("Can't open %s", fname);
> + exitstatus = 127;
> + exraise(EXEXIT);
> }
> if (fd < 10)
> fd = savefd(fd, fd);
> --
> 1.6.0.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe dash" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-19 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-29 11:15 [PATCH 1/2] [INPUT] exit 127 if command_file is given but does not exist Gerrit Pape
2010-03-19 16:20 ` Gerrit Pape
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.