Subject: bin/15544: /bin/sh trap command not POSIX compliant
To: None <>
From: None <>
List: netbsd-bugs
Date: 02/08/2002 16:19:18
>Number:         15544
>Category:       bin
>Synopsis:       /bin/sh trap command does not accept signal names
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 08 16:20:00 PST 2002
>Originator:     Jon Buller
>Release:        NetBSD 1.5.3_ALPHA  20020122 (or there abouts)
System: NetBSD 1.5.3_ALPHA NetBSD 1.5.3_ALPHA (BULLBALL) #1: Tue Jan 8 21:51:41 PST 2002 sparc
Architecture: sparc
Machine: sparc
	cat << EOF > foo

trap "echo trapped" INT

exit 0
	chmod 755 foo

What you get is the message "trap: Illegal number: INT"

I was told this in relation to the problem:

	  It appears that your shell does not permit symbolic signal
	  names? They are required by Posix and the only work-around,
	  using numeric signal names, is only permitted -- not
	  required by Posix.

	see above
	Work around by using ksh.  I think the fix needs to be made
	on line 110 of /usr/src/bin/sh/trap.c  (rev by
	making is_number() also recognize signal names.  Line 115
	also needs to be fixed to return the signal number when
	number() is given a string with the proper name.