From c6988f3340d0c967b9403f5a2569bec1c8413913 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 28 Sep 2011 16:05:06 +0200 Subject: [PATCH] tap/awk: handle exit statuses > 256 (seen on few korn shells) Some Korn shells, when a child process die due to signal number n, can leave in $? an exit status of 256+n instead of the more standard 128+n. Apparently, both behaviours are allowed by POSIX, so be prepared to handle them both. This change has been motivated by a testsuite failure on Debian with the AT&T Korn Shell version 93u-1. * lib/tap-driver.sh (get_test_exit_message): Handle the described Korn Shell behaviour too. ($scriptversion): Update. --- ChangeLog | 13 +++++++++++++ lib/tap-driver.sh | 12 ++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4fb02f52d..ad6e9d6fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2011-09-28 Stefano Lattarini + + tap/awk: handle exit statuses > 256 (seen on few korn shells) + Some Korn shells, when a child process die due to signal number + n, can leave in $? an exit status of 256+n instead of the more + standard 128+n. Apparently, both behaviours are allowed by + POSIX, so be prepared to handle them both. + This change has been motivated by a testsuite failure on Debian + with the AT&T Korn Shell version 93u-1. + * lib/tap-driver.sh (get_test_exit_message): Handle the described + Korn Shell behaviour too. + ($scriptversion): Update. + 2011-09-24 Stefano Lattarini uninstall: "make uninstall" before "make install" works diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh index 44317d9de..e30c8039c 100755 --- a/lib/tap-driver.sh +++ b/lib/tap-driver.sh @@ -23,7 +23,7 @@ # bugs to or send patches to # . -scriptversion=2011-08-25.11; # UTC +scriptversion=2011-09-28.14; # UTC # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. @@ -440,7 +440,15 @@ function get_test_exit_message(status) exit_details = " (command not found?)" else if (status >= 128 && status <= 255) exit_details = sprintf(" (terminated by signal %d?)", status - 128) - else if (status >= 256) + else if (status > 256 && status <= 384) + # We used to report an "abnormal termination" here, but some Korn + # shells, when a child process die due to signal number n, can leave + # in $? an exit status of 256+n instead of the more standard 128+n. + # Apparently, both behaviours are allowed by POSIX (2008), so be + # prepared to handle them both. + exit_details = sprintf(" (terminated by signal %d?)", status - 256) + else + # Never seen in practice. exit_details = " (abnormal termination)" return sprintf("exited with status %d%s", status, exit_details) } -- 2.47.2