Package: devscripts
Version: 2.16.8

Hi,

It seems that referring to the signals with a SIG prefix is not
something that has to be supported by the POSIX standard:


​http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html:
""""
RATIONALE

    Implementations may permit lowercase signal names as an extension.
Implementations may also accept the names with the SIG prefix; no known
historical shell does so. The trap and kill utilities in this volume of
IEEE Std 1003.1-2001 are now consistent in their omission of the SIG
prefix for signal names. Some kill implementations do not allow the
prefix, and kill -l lists the signals without prefixes.

    Trapping SIGKILL or SIGSTOP is syntactically accepted by some
historical implementations, but it has no effect. Portable POSIX
applications cannot attempt to trap these signals.
""""

And this is major problem, because our default /bin/sh (dash) fails to
run scripts using SIGSOMETHING.


Check this example:


$ cat test.sh
#/bin/sh
trap "echo hi from int" SIGINT
kill -INT $$

$ bash test.sh
hi from int

$ dash test.sh
trap: SIGINT: bad trap

$ sh test.sh
trap: SIGINT: bad trap

$ ./test.sh
trap: SIGINT: bad trap


To fix the script, SIGINT should be replaced with INT

So I think checkbashishm should warn always that it finds SIGSOMETHING
on a trap line.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to