kill -L behaviour (is it a doc or code error?)

Bug #1488939 reported by G.M.
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
Confirmed
High
Unassigned
bash (Ubuntu)
Triaged
Low
Unassigned

Bug Description

$man kill
[...]
       -L, --table
              List signal names in a nice table.
[...Examples section]
       kill -L
              List the available signal choices in a nice table.

$ kill -L
bash: kill: L: invalid signal specification

I'm not sure if it is a doc or code error, but the actual behaviour is not what the doc describes...

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for reporting this issue.

I cannot really answer your question, but I see the same behaviour with procps 1:3.3.9-1ubuntu8 on Ubuntu 15.04

Changed in procps (Ubuntu):
status: New → Confirmed
tags: added: manpage vivid
Changed in procps (Ubuntu):
importance: Undecided → High
Changed in hundredpapercuts:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I wanted to fix it in the procps package where kill belongs to.
But there everything is ok, like:

.libs/kill -l
HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT
CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS

 .libs/kill --list
HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT
CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS

.libs/kill -L
 1 HUP 2 INT 3 QUIT 4 ILL 5 TRAP 6 ABRT 7 BUS
 8 FPE 9 KILL 10 USR1 11 SEGV 12 USR2 13 PIPE 14 ALRM
15 TERM 16 STKFLT 17 CHLD 18 CONT 19 STOP 20 TSTP 21 TTIN
22 TTOU 23 URG 24 XCPU 25 XFSZ 26 VTALRM 27 PROF 28 WINCH
29 POLL 30 PWR 31 SYS

.libs/kill --table
 1 HUP 2 INT 3 QUIT 4 ILL 5 TRAP 6 ABRT 7 BUS
 8 FPE 9 KILL 10 USR1 11 SEGV 12 USR2 13 PIPE 14 ALRM
15 TERM 16 STKFLT 17 CHLD 18 CONT 19 STOP 20 TSTP 21 TTIN
22 TTOU 23 URG 24 XCPU 25 XFSZ 26 VTALRM 27 PROF 28 WINCH
29 POLL 30 PWR 31 SYS

Just how it should be.

Next I thought this is upstream, maybe it is broken back in 14.04 I have or the 15.04 it was reported by others.
But in fact it turns out, it isn't procps at all.

It is the bash builtin "kill" which doesn't match the man page of the procps kill.
Because when running against /bin/kill all the commands work as described in the manpage.

To make it complete here a summary of the bash builtin kill functionality regarding these options
1. Works
kill -l
kill -l <SIGNUM>

2. doesn't work
kill --list
kill --table
kill -L

The output of bashs "kill -l" is more or less equivalent to the procps "kill -L" in table format.

So what is really missing could be just mapping the existing code for -l in the bash builtin to the options "--list", "--table", and "-L".
That would be least invasive and fix the mapping of the real binary man page and the bash builtin to 99%.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

From the procps man page:
  The -L flag is Linux-specific.

Also I would expect that the long options might be special or new, so I'm not sure how willing bash will be to take a modification for this.

BTW - these are the allowed parameters from the bash Doc
Options:
  -s sig SIG is a signal name
  -n sig SIG is a signal number
  -l list the signal names; if arguments follow `-l' they are
        assumed to be signal numbers for which names should be listed

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

The parameter parsing for the bash builtins is based on this:
   #define ISOPTION(s, c) (s[0] == '-' && !s[2] && s[1] == c)

In addition the -- is used to recognize negative numbers to signify process groups instead of just a process.

This is rather unusable for lonopts, but at least the -L could be coded without being too invasive.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I proposed a merge including my fix for further review (https://code.launchpad.net/~paelzer/ubuntu/wily/bash/fix-for-1488939/+merge/272916) and also started a discussion at <email address hidden> to get their feedback regarding changing options. I will add a link to the thread once it shows up in the archives.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Add -L option to bash builtin of kill to be more compatible to procps version of kill (proper formatting)" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Robie Basak (racb) wrote :

Christian has explained to me that the fix would be in the bash builtin, not in procps.

Revision history for this message
Robie Basak (racb) wrote :

I also think this is low priority in Ubuntu as it isn't worth adding a delta over. It can be sent and addressed upstream, and we'll carry the fix in Ubuntu when it arrives.

affects: procps (Ubuntu) → bash (Ubuntu)
Changed in bash (Ubuntu):
importance: High → Low
status: Confirmed → Triaged
Revision history for this message
Robie Basak (racb) wrote :

(I understand that if procps' documentation did not match behaviour that would certainly be more important, but it turns out that it's really just a mismatch between bash's builtin and procps' documentation and behaviour, which is certainly a papercut level UX issue but not so obviously a bug)

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I dropped the merge proposal for wily since it would even be a SRU now.
I'll follow up on the upstreaming of bash which in the meantime made it to the archive at
https://lists.gnu.org/archive/html/bug-bash/2015-10/msg00004.html

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Since the basic issue is understood in bash vs gnu kill implementation IMHO there is no reason to carry an Ubuntu delta just for that.

I still want it properly fixed one day, and not just explained.
As far as it looks right now this seems to become part of bash 4.4.

Which means this bug will stay open until we adopt bash 4.4 one day and then be verified and closed.
If anybody objects to that please let me know.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.