SUMMARY: Why does ksh coredump on kill -0 ?

From: Bütow, Michael (michael.buetow@comsoft.de)
Date: Wed Jun 30 2004 - 09:42:27 EDT


Thanks to Kris Smith, Roberto Romani, Bob Vickers and Dr Thomas Blinn for their helpful answers.

I overlooked that the Tru64 ksh has a builtin kill command. This builtin kill seems to support the -0 option (for checking the existence of a process), and indeed it works fine as long as you pass it one or more process ID(s).
But without process ID's, it causes the shell to dump core (probably parsing error).

In the end I just made sure to call the script with process IDs, but the proper solution would be to use the /usr/bin/kill command which handles the -0 without PIDs just fine.

Roberto also suggested the use of

#!/bin/ksh -x

to track this sort of problem down more efficiently. I ended up simply logging debug messages to a file from all sort of places in my script to find out the command that caused the coredump :-)

Best regards,
Michael

-----Ursprüngliche Nachricht-----
Von: Bob Vickers [mailto:bobv@cs.rhul.ac.uk]
Gesendet: Mittwoch, 30. Juni 2004 15:16
An: Bütow, Michael
Betreff: Re: Why does ksh coredump on kill -0 ?

Michael,

Just for the record, you are looking in the wrong man page. 'kill' is a
shell built-in, so you should look in the ksh man page.

However, you won't find the right man page any more informative! It has no
mention of this behaviour.

The 'kill' program does not have this feature: if you type
   /bin/kill -0
nothing happens.

Bob

On Wed, 30 Jun 2004, "Bütow, Michael" wrote:

> Hello managers,
>
> I don't understand why the Tru64 ksh coredumps with the following script:
>
> #!/bin/ksh
> kill -0
>
>
> I believe this happens under V4.X up to V5.1B, and I can't find anything in the kill manpage to indicate that this is on purpose.
> Does anybody have an explanation for this apparent misbehavior?
>
> Best regards,
> Michael
>
>
>
>

==============================================================
Bob Vickers R.Vickers@cs.rhul.ac.uk
Dept of Computer Science, Royal Holloway, University of London
WWW: http://www.cs.rhul.ac.uk/home/bobv
Phone: +44 1784 443691



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:50:02 EDT