From e0d3284bc95d3d6b6660e8881454caf367ce460b Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Tue, 17 Mar 2020 12:49:58 -0400 Subject: [PATCH] Exit status 256+signum is actually baked in to ksh While #10121 did fix the signal numbers for FreeBSD/Darwin, it incorrectly changed the expected encoding of exit status for commands that exited on a signal. The encoding 256+signum is a feature of the shell. Only the signal numbers themselves are platform-dependent. Always use the encoding 256+signum when checking exit status for signal exits. Reviewed-by: Brian Behlendorf Reviewed-by: John Kennedy Signed-off-by: Ryan Moeller Closes #10137 --- tests/test-runner/include/logapi.shlib | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/test-runner/include/logapi.shlib b/tests/test-runner/include/logapi.shlib index 86a345b7a..334a04532 100644 --- a/tests/test-runner/include/logapi.shlib +++ b/tests/test-runner/include/logapi.shlib @@ -165,26 +165,20 @@ function log_mustnot_expect (( $? != 0 )) && log_fail } -# Exit status encoding is platform-dependent +# Signal numbers are platform-dependent case $(uname) in Darwin|FreeBSD) - EXIT_SIGNAL=128 SIGBUS=10 SIGSEGV=11 ;; -illumos) - EXIT_SIGNAL=256 - SIGBUS=7 - SIGSEGV=11 - ;; -Linux|*) - EXIT_SIGNAL=128 +illumos|Linux|*) SIGBUS=7 SIGSEGV=11 ;; esac EXIT_SUCCESS=0 EXIT_NOTFOUND=127 +EXIT_SIGNAL=256 EXIT_SIGBUS=$((EXIT_SIGNAL + SIGBUS)) EXIT_SIGSEGV=$((EXIT_SIGNAL + SIGSEGV))