[PATCH] ash.c: repairing kill for susv3

Mats Erik Andersson mats.andersson64 at comhem.se
Wed Apr 18 11:18:07 PDT 2007


Hi!

My very first patch for ash.c could only fix the builtin
call "kill -l", whereas the second patch digressed from
the intended Susv3 compatibility. I would like to aim
at the SuSv3 standard with this third patch.

The intention is to implement a functionality displayed
in the help text as

	kill -l exitstatus

where SuSv3 says "exitstatus" should be a numerical value
and may denote a valid signal, which should then be returned
as its ascii name.
 
There are two lines in shell/ash.c.svn that prevents any
success of reaching that functionality:

3582:   name = get_signame(signo);
3583:   if (!isdigit(*name))

The latter line contains an erroneous negation, which is
exactly opposite to the needs, whereas the first is doomed
since signo=-1 every time that code is effectuated.

Hence my present patch exchanges those two lines for

        name = get_signame(atoi(*argptr));
        if (isdigit(*name))

and now "kill -l 5" will return TRAP, as is desired.
My previous patch suggestion made both observations, but was
not clever enough to call atoi().

However, I have not been able to understand beyond any doubt
whether SuSv3 intends a use like "kill -l $?" and a corresponding
printing of named exit statuses. The printout EXIT does at
present appear, on the other hand, and is related to a TODO-remark
of Rob Landley inside libbb/u_signal_names.c.

Regards,   Mats E Andersson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ash_with_nearly_susv3_kill.diff
Type: text/x-patch
Size: 583 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20070418/b6cfde44/attachment.bin 


More information about the busybox mailing list