bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible bug in kill builtin


From: Job Noorman
Subject: Possible bug in kill builtin
Date: Tue, 01 Oct 2013 13:04:12 +0200
User-agent: KMail/4.10.5 (Linux/3.8.0-31-generic; KDE/4.10.5; x86_64; ; )

Hi all,

I just noticed some strange behavior with the kill builtin and was wondering 
whether 
this is a bug or not. The following applies to using kill on stopped processes 
(I didn't 
test it on running processes).

When using 'kill jobspec', the SIGTERM signal is sent to the process followed 
by a 
SIGCONT. The net result is the process immediately receiving SIGTERM and, 
normally, 
being terminated.

When using 'kill pid', however, only SIGTERM is sent. This means the process 
won't 
receive the signal before being (manually) resumed.

Here is a full example for the jobspec case:
$ cat
^Z
[1]+  Stopped                 cat
$ ps
  PID TTY          TIME CMD
 3200 pts/5    00:00:00 bash
19123 pts/5    00:00:00 cat
19124 pts/5    00:00:00 ps
$ kill %1
$ ps
  PID TTY          TIME CMD
 3200 pts/5    00:00:00 bash
19125 pts/5    00:00:00 ps
[1]+  Terminated              cat

And for the pid case:
$ cat
^Z
[1]+  Stopped                 cat
$ ps
  PID TTY          TIME CMD
 3200 pts/5    00:00:00 bash
19126 pts/5    00:00:00 cat
19127 pts/5    00:00:00 ps
$ kill 19126
$ ps
  PID TTY          TIME CMD
 3200 pts/5    00:00:00 bash
19126 pts/5    00:00:00 cat
19128 pts/5    00:00:00 ps
$ fg
cat
Terminated
$ ps
  PID TTY          TIME CMD
 3200 pts/5    00:00:00 bash
19129 pts/5    00:00:00 ps

Is this desired behavior? If so, maybe something could be added to the 
documentation 
about this because it seems very confusing to me.

Regards,
Job

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]