m4-patches
[Top][All Lists]
Advanced

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

sysval test [was: GNU M4 1.4.5 test failures]


From: Eric Blake
Subject: sysval test [was: GNU M4 1.4.5 test failures]
Date: Wed, 19 Jul 2006 06:34:42 -0600
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 7/18/2006 7:03 AM:
> Checking ./096.sysval
> @ ../doc/m4.texinfo:3788: Origin of test
> ./096.sysval: stdout mismatch
> 2c2
> < 256
> ---
>>> 129
> 
> OK, the assumption here was that `kill -1 $$' would exit a shell with
> signal 1 (ie. WIFSIGNALED true), but this old platform exited instead with
> a non-signal value of 129 (although that corresponds to signal 1).

I reproduced it on my machine, by replacing /bin/sh with pdksh.  ksh traps
SIGHUP, then exits normally with status 129 in WEXITSTATUS, rather than
letting SIGHUP terminate ksh with status 1 in WTERMSIG.  I know -9 is
portable, and on all the shells I've tried (bash, pdksh, zsh, ash), it
seemed like -13 (SIGPIPE) was also portable (ie. always terminated the
shell with the default handler, rather than being caught be the shell and
converted into a regular exit).  So I propose this patch:

2006-07-19  Eric Blake  <address@hidden>

        * doc/m4.texinfo (Sysval): Avoid kill -1, since ksh traps SIGHUP
        and exits normally.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEvibi84KuGfSFAYARAoV5AJ93tFy/7WXa0sDMUaiTAMCUFFz02wCcDxzN
xO4BYrmeZpq7vlb0LnkhKPk=
=rLar
-----END PGP SIGNATURE-----
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.49
diff -u -p -r1.1.1.1.2.49 m4.texinfo
--- doc/m4.texinfo      19 Jul 2006 12:14:13 -0000      1.1.1.1.2.49
+++ doc/m4.texinfo      19 Jul 2006 12:31:27 -0000
@@ -3735,14 +3735,23 @@ On UNIX platforms, where it is possible 
 is terminated by a signal, rather than a normal exit, the result is the
 signal number shifted left by eight bits.
 
address@hidden This test has difficulties being portable, even on platforms
address@hidden where syscmd invokes /bin/sh.  Kill is not portable with signal
address@hidden names.  According to autoconf, the only portable signal numbers
address@hidden are 1 (HUP), 2 (INT), 9 (KILL), 13 (PIPE) and 15 (TERM).  But
address@hidden all shells handle SIGINT, and ksh handles HUP (as in, the shell
address@hidden exits normally rather than letting the signal terminate it).
address@hidden Also, TERM is flaky, as it can also kill the running m4 on
address@hidden systems where /bin/sh does not create its own process group.
address@hidden That leaves KILL and PIPE as the two signals tested.
 @example
 dnl This test assumes kill is a shell builtin, and that signals are
 dnl recognizable.
 ifdef(`__unix__', , `m4exit(`77')')dnl
-syscmd(`kill -1 $$')
+syscmd(`kill -13 $$')
 @result{}
 sysval
address@hidden
address@hidden
 esyscmd(`kill -9 $$')
 @result{}
 sysval

reply via email to

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