Bug 546395 - kill bash shell-builtin doesn't act as /bin/kill with PGIDs
Summary: kill bash shell-builtin doesn't act as /bin/kill with PGIDs
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: 13
Hardware: x86_64
OS: Linux
low
low
Target Milestone: ---
Assignee: Roman Rakus
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-12-10 19:35 UTC by Jan Christiaan van Winkel
Modified: 2014-01-13 00:10 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-06-27 14:40:43 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jan Christiaan van Winkel 2009-12-10 19:35:59 UTC
Description of problem:
When trying to kill a processgroup with 'kill -s <SIGNAL> -<PGID>' an error occurs. The built-in Kill seems to interpret the processgroup as a signal number.

- Killing the processgroup with the default signal does work okay.
- Not using the '-s' optionflag also works fine.
- The executable /bin/kill doesn't have this problem, the shell-builtin does. 

Version-Release number of selected component (if applicable):
bash-4.0.33-1.fc12.x86_64

How reproducible:
Allways, using commands below.

Steps to Reproduce:
$ sleep 100 | sleep 200 | sleep 300 &
[1] 6717

$ ps -j
  PID PGID SID TTY TIME CMD
 6492 6492 6492 pts/1 00:00:00 bash
 6715 6715 6492 pts/1 00:00:00 sleep
 6716 6715 6492 pts/1 00:00:00 sleep
 6717 6715 6492 pts/1 00:00:00 sleep
 6718 6718 6492 pts/1 00:00:00 ps

$ kill -s TERM -6715
-bash: kill: 6715: invalid signal specification


Actual results:
-bash: kill: 6715: invalid signal specification
and process group NOT killed

Expected results:
[1]+ Terminated sleep 100 | sleep 200 | sleep 300
and process group killed

Additional info:
/bin/kill works as expected, and as specified in the kill man page:
kill -s SIGNAL -PGID

the kill bash built-in is only built in to allow usage of %jobid and to prevent starting an extra process to kill one.  However, it should otherwise behave as /bin/kill.  The man page of /bin/kill is clear: usage of -s for a signal number is allowed, and using a negative number, the (absolute value of the) number is used as the process group ID in stead of as a PID.

/bin/kill works as expected.

Also, usage of kill -s SUGNUM PID works for positive numbers (i.e. real pid's).  Also not using -s works as expected for numerically specified signals, but not for symbolically named signals:

$ sleep 100 | sleep 200 | sleep 300 &
[1] 19039
$ ps -j
  PID  PGID   SID TTY          TIME CMD
15104 15104 15104 pts/1    00:00:00 bash
19037 19037 15104 pts/1    00:00:00 sleep
19038 19037 15104 pts/1    00:00:00 sleep
19039 19037 15104 pts/1    00:00:00 sleep
19040 19040 15104 pts/1    00:00:00 ps
[jc@minioreo ~]$ kill -15 -19037
[1]+  Terminated              sleep 100 | sleep 200 | sleep 300


$ sleep 100 | sleep 200 | sleep 300 &
[1] 19052
$ ps -j
  PID  PGID   SID TTY          TIME CMD
15104 15104 15104 pts/1    00:00:00 bash
19050 19050 15104 pts/1    00:00:00 sleep
19051 19050 15104 pts/1    00:00:00 sleep
19052 19050 15104 pts/1    00:00:00 sleep
19053 19053 15104 pts/1    00:00:00 ps
[jc@minioreo ~]$ kill -TERM -19050
[1]+  Terminated              sleep 100 | sleep 200 | sleep 300

Comment 1 Roman Rakus 2009-12-11 13:15:35 UTC
Thanks for the report.
kill builtin works exactly as you said.
I have post a request upstream: http://www.mail-archive.com/bug-bash@gnu.org/msg06651.html

Comment 2 Bug Zapper 2010-11-04 03:40:58 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Jan Christiaan van Winkel 2010-11-06 19:56:20 UTC
Still true for F13.

Comment 4 Bug Zapper 2011-06-02 17:08:55 UTC
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 5 Bug Zapper 2011-06-27 14:40:43 UTC
Fedora 13 changed to end-of-life (EOL) status on 2011-06-25. Fedora 13 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.