SUSv4 says trap foo UNKNOWN is not a syntax error, merely exit ≠0.
Inspired by 673dab8698b0399c967216c02262eaf95361a75c.
This commit is contained in:
parent
bdfcdc56c8
commit
30d8e3934d
24
check.t
24
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.402 2011/01/30 01:35:32 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.403 2011/01/30 01:35:56 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas 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: 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 $
|
# $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
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R39 2011/01/22
|
@(#)MIRBSD KSH R39 2011/01/29
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@ -3385,6 +3385,26 @@ expected-stdout:
|
|||||||
line <6>
|
line <6>
|
||||||
expected-exit: 1
|
expected-exit: 1
|
||||||
---
|
---
|
||||||
|
name: unknown-trap
|
||||||
|
description:
|
||||||
|
Ensure unknown traps are not a syntax error
|
||||||
|
stdin:
|
||||||
|
(
|
||||||
|
trap "echo trap 1 executed" UNKNOWNSIGNAL || echo "foo"
|
||||||
|
echo =1
|
||||||
|
trap "echo trap 2 executed" UNKNOWNSIGNAL EXIT 999999 FNORD
|
||||||
|
echo = $?
|
||||||
|
) 2>&1 | sed "s^${__progname}: <stdin>\[[0-9]*]PROG"
|
||||||
|
expected-stdout:
|
||||||
|
PROG: trap: bad signal 'UNKNOWNSIGNAL'
|
||||||
|
foo
|
||||||
|
=1
|
||||||
|
PROG: trap: bad signal 'UNKNOWNSIGNAL'
|
||||||
|
PROG: trap: bad signal '999999'
|
||||||
|
PROG: trap: bad signal 'FNORD'
|
||||||
|
= 3
|
||||||
|
trap 2 executed
|
||||||
|
---
|
||||||
name: read-IFS-1
|
name: read-IFS-1
|
||||||
description:
|
description:
|
||||||
Simple test, default IFS
|
Simple test, default IFS
|
||||||
|
20
funcs.c
20
funcs.c
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.167 2011/01/22 20:33:13 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.168 2011/01/30 01:35:58 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@ -2336,15 +2336,15 @@ c_trap(const char **wp)
|
|||||||
s = NULL;
|
s = NULL;
|
||||||
|
|
||||||
/* set/clear traps */
|
/* set/clear traps */
|
||||||
while (*wp != NULL) {
|
i = 0;
|
||||||
p = gettrap(*wp++, true);
|
while (*wp != NULL)
|
||||||
if (p == NULL) {
|
if ((p = gettrap(*wp++, true)) == NULL) {
|
||||||
bi_errorf("bad signal '%s'", wp[-1]);
|
warningf(true, "%s: %s '%s'", builtin_argv0,
|
||||||
return (1);
|
"bad signal", wp[-1]);
|
||||||
}
|
++i;
|
||||||
settrap(p, s);
|
} else
|
||||||
}
|
settrap(p, s);
|
||||||
return (0);
|
return (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
4
sh.h
4
sh.h
@ -154,9 +154,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.425 2011/01/30 01:35:35 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.426 2011/01/30 01:36:00 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R39 2011/01/22"
|
#define MKSH_VERSION "R39 2011/01/29"
|
||||||
|
|
||||||
#ifndef MKSH_INCLUDES_ONLY
|
#ifndef MKSH_INCLUDES_ONLY
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user