Subject: Re: ksh: trap: bad signal
To: None <current-users@NetBSD.org>
From: Jukka Salmi <j+nbsd@2006.salmi.ch>
List: current-users
Date: 11/03/2006 09:44:38
--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Jukka Salmi --> current-users (2006-11-03 08:59:39 +0100):
> Hi,
> 
> on a -current system built using yesterday's sources ksh is broken:
> 
> $ trap
> $ trap : INT
> ksh: trap: bad signal INT
> 
> Using the signal number instead works, but the output is still wrong:
> 
> $ trap
> $ trap : 2
> $ trap
> trap -- : (null %s)
> 
> I haven't had time to debug this yet...

The attached patch fixes the problem. Hmm, maybe siglist.sh should be
rewritten from scratch...


Regards, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: bin/ksh/siglist.sh
===================================================================
RCS file: /cvsroot/src/bin/ksh/siglist.sh,v
retrieving revision 1.4
diff -u -p -r1.4 siglist.sh
--- bin/ksh/siglist.sh	16 Oct 2006 00:07:32 -0000	1.4
+++ bin/ksh/siglist.sh	3 Nov 2006 08:40:43 -0000
@@ -23,12 +23,12 @@ CPP="${1-cc -E}"
 	{ QwErTy .signal = SIG\1 , .name = "\1", .mess = "\2" },\
 #endif/') > $in
 $CPP $in  > $out
-sed -n 's/{ QwErTy/{/p' < $out | awk '{print NR, $0}' | sort -k3n -k1n |
+sed -n 's/{ QwErTy/{/p' < $out | awk '{print NR, $0}' | sort -k5n -k1n |
     sed 's/^[0-9]* //' |
     awk 'BEGIN { last=0; nsigs=0; }
 	{
-	    if ($2 ~ /^[0-9][0-9]*$/ && $3 == ",") {
-		n = $2;
+	    if ($4 ~ /^[0-9][0-9]*$/ && $5 == ",") {
+		n = $4;
 		if (n > 0 && n != last) {
 		    while (++last < n) {
 			printf "\t{ .signal = %d , .name = NULL, .mess = `Signal %d` } ,\n", last, last;

--k1lZvvs/B4yU6o8G--