SUSv4 says that there be exit 127; the old code tried but failed, so it
was an actual programmatical bug…
This commit is contained in:
parent
c8955138ec
commit
ff8b75f46f
26
check.t
26
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.311 2009/09/26 03:39:57 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.312 2009/09/29 12:28:12 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
@ -25,7 +25,7 @@
|
||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R39 2009/09/25
|
||||
@(#)MIRBSD KSH R39 2009/09/29
|
||||
description:
|
||||
Check version of shell.
|
||||
stdin:
|
||||
@ -6425,3 +6425,25 @@ expected-stdout:
|
||||
exiting
|
||||
bar: global
|
||||
---
|
||||
name: susv4-exit-enoent-1
|
||||
description:
|
||||
SUSv4 says that the shell should exit with 126/127 in some situations
|
||||
stdin:
|
||||
i=0
|
||||
echo : >x
|
||||
"$__progname" ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
|
||||
"$__progname" -c ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
|
||||
echo exit 42 >x
|
||||
"$__progname" ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
|
||||
"$__progname" -c ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
|
||||
rm -f x
|
||||
"$__progname" ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
|
||||
"$__progname" -c ./x >/dev/null 2>&1; r=$?; echo $((i++)) $r .
|
||||
expected-stdout:
|
||||
0 0 .
|
||||
1 126 .
|
||||
2 42 .
|
||||
3 126 .
|
||||
4 127 .
|
||||
5 127 .
|
||||
---
|
||||
|
12
main.c
12
main.c
@ -33,7 +33,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.150 2009/09/27 10:31:06 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.151 2009/09/29 12:28:13 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -320,13 +320,17 @@ main(int argc, const char *argv[])
|
||||
kshname = argv[argi++];
|
||||
} else if (argi < argc && !Flag(FSTDIN)) {
|
||||
s = pushs(SFILE, ATEMP);
|
||||
s->file = kshname = argv[argi++];
|
||||
s->file = argv[argi++];
|
||||
s->u.shf = shf_open(s->file, O_RDONLY, 0,
|
||||
SHF_MAPHI | SHF_CLEXEC);
|
||||
if (s->u.shf == NULL) {
|
||||
exstat = 127; /* POSIX */
|
||||
errorf("%s: %s", s->file, strerror(errno));
|
||||
shl_stdout_ok = 0;
|
||||
warningf(true, "%s: %s", s->file, strerror(errno));
|
||||
/* mandated by SUSv4 */
|
||||
exstat = 127;
|
||||
unwind(LERROR);
|
||||
}
|
||||
kshname = s->file;
|
||||
} else {
|
||||
Flag(FSTDIN) = 1;
|
||||
s = pushs(SSTDIN, ATEMP);
|
||||
|
4
sh.h
4
sh.h
@ -134,9 +134,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.350 2009/09/26 04:01:33 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.351 2009/09/29 12:28:13 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R39 2009/09/25"
|
||||
#define MKSH_VERSION "R39 2009/09/29"
|
||||
|
||||
#ifndef MKSH_INCLUDES_ONLY
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user