-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The coreutils 5.3.0 testsuite has a test (tests/install/trap) that wants to trap SIGCHLD to detect an infinite loop in install(1) when SIGCHLD was ignored. But SIGCHLD is not one of the portable signal numbers (on the systems I have access to, it is 18 on Solaris and 20 on cygwin). Note that coreutils kill(1), bash's builtin kill, and zsh's builtin kill all have the ability to convert a single signal between name and number: $ kill -l CHLD 20 $ kill -l 20 CHLD Ash does not accept signal names, but uses the system's kill (which for my cygwin system is from coreutils): $ trap '' CHLD trap: bad signal CHLD $ trap -l trap: bad option -l $ type kill kill is /usr/bin/kill $ kill -l CHLD 20 Solaris /bin/sh has a builtin kill with limited capabilities, but also has /bin/kill that does what is desired: $ type kill kill is a shell builtin $ kill -l CHLD kill: bad signal $ /bin/kill -l CHLD 18 ksh and pdksh use a builtin that can only do one direction of the mapping: $ type kill kill is a shell builtin $ kill -l CHLD ksh: kill: CHLD: bad number $ kill -l 20 CHLD Are there any systems where there are no accessible versions of kill(1) which can convert either a single signal name to number, or vice versa? I'm hoping that something like the following can be used to portably trap an otherwise non-portable signal number, and welcome any help from the list to turn this into something worthy of adding to autoconf.texi: # My attempt to portably trap SIGCHLD for k in kill /bin/kill /usr/bin/kill do chld=`$kill -l CHLD 2> /dev/null` test -n "$chld" && break; done if test -z "$chld" ; then for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \ 21 22 23 24 25 26 27 28 29 30 31 32 do if test x"`kill -l $i 2> /dev/null`" = xCHLD ; then chld=$i break fi done fi if test -n "$chld" ; then trap '' $chld else echo Failed to find value of SIGCHLD exit 1 fi Of course, for the coreutils testsuite, the solution is simple - coreutils bundles kill(1), so it can use the just-built kill to determine SIGCHLD in the tests/install/trap test, but that is besides the point for the general question. - -- Life is short - so eat dessert first! Eric Blake ebb9@xxxxxxx -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB+yFE84KuGfSFAYARAv5nAJ93YyJYJJh54EfHNfsOAuB1fcZ42ACgooP/ yI/sgGw+fjSGRqsUCLMhZXI= =DqCe -----END PGP SIGNATURE----- _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf