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 <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10137
This commit is contained in:
parent
4d32abaa87
commit
e0d3284bc9
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in New Issue