automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI 1/2] {test-protocols} tap/awk: handle exit statuses > 256 (seen on


From: Stefano Lattarini
Subject: [FYI 1/2] {test-protocols} tap/awk: handle exit statuses > 256 (seen on few korn shells)
Date: Wed, 28 Sep 2011 16:34:13 +0200

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 4fb02f5..ad6e9d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-09-28  Stefano Lattarini  <address@hidden>
+
+       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  <address@hidden>
 
        uninstall: "make uninstall" before "make install" works
diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh
index 44317d9..e30c803 100755
--- a/lib/tap-driver.sh
+++ b/lib/tap-driver.sh
@@ -23,7 +23,7 @@
 # bugs to <address@hidden> or send patches to
 # <address@hidden>.
 
-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)
 }
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]