Debian Bug report logs - #497540
bash-completion: killall completion uses command with arguments instead of command name

Package: bash-completion; Maintainer for bash-completion is Gabriel F. T. Gomes <gabriel@debian.org>; Source for bash-completion is src:bash-completion (PTS, buildd, popcon).

Reported by: Fabian Bieler <der.fabe@gmx.net>

Date: Tue, 2 Sep 2008 12:48:02 UTC

Severity: normal

Tags: unreproducible, wontfix

Done: David Paleino <d.paleino@gmail.com>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Bash Completion Maintainers <bash-completion-devel@lists.alioth.debian.org>:
Bug#497540; Package bash-completion. (full text, mbox, link).


Acknowledgement sent to Fabian Bieler <der.fabe@gmx.net>:
New Bug report received and forwarded. Copy sent to Bash Completion Maintainers <bash-completion-devel@lists.alioth.debian.org>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Fabian Bieler <der.fabe@gmx.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: bash-completion: killall completion uses command with arguments instead of command name
Date: Tue, 02 Sep 2008 14:50:11 +0200
Package: bash-completion
Severity: normal
Tags: patch

killall expects only the command name without arguments or path of the process to kill, e.g. if you want to kill the process with the command line "/usr/bin/dbus-daemon --system", you would have to do "killall dbus-daemon". However, bash_completion for killall tries to find matches using the complete command line.

The following patch addresses this issue by using "ps axo comm" instead of "ps axo command".

diff -u bash-completion.orig/bash_completion bash-completion/bash_completion
--- bash-completion.orig/bash_completion        2008-07-05 15:55:03.000000000 +0200
+++ bash-completion/bash_completion     2008-09-02 14:31:25.000000000 +0200
@@ -947,7 +947,7 @@
 	if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
 		_signals
 	else
-		COMPREPLY=( $( compgen -W '$( command ps axo command | \
+		COMPREPLY=( $( compgen -W '$( command ps axo comm | \
 			      sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \
 			      sed -e "s/.*\///" )' -- $cur ) )
 	fi

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26.3 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash




Tags added: confirmed, pending Request was from David Paleino <d.paleino@gmail.com> to control@bugs.debian.org. (Sat, 06 Sep 2008 12:42:03 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Bash Completion Maintainers <bash-completion-devel@lists.alioth.debian.org>:
Bug#497540; Package bash-completion. (Wed, 21 Jan 2009 22:15:02 GMT) (full text, mbox, link).


Acknowledgement sent to Yanko Kaneti <yaneti@declera.com>:
Extra info received and forwarded to list. Copy sent to Bash Completion Maintainers <bash-completion-devel@lists.alioth.debian.org>. (Wed, 21 Jan 2009 22:15:02 GMT) (full text, mbox, link).


Message #12 received at 497540@bugs.debian.org (full text, mbox, reply):

From: Yanko Kaneti <yaneti@declera.com>
To: 497540@bugs.debian.org
Date: Thu, 22 Jan 2009 00:13:39 +0200
It would be nice if this worked but current release of procps trim the
command name to 15 even if the ps comm  column is specified with
additional width.  And these days there are many commands with names
longer than 15  e.g. gnome-blah-blah..






Bug 497540 cloned as bug 513460. Request was from David Paleino <d.paleino@gmail.com> to control@bugs.debian.org. (Thu, 29 Jan 2009 10:36:01 GMT) (full text, mbox, link).


Information stored :
Bug#497540; Package bash-completion. (Thu, 29 Jan 2009 10:36:08 GMT) (full text, mbox, link).


Acknowledgement sent to David Paleino <d.paleino@gmail.com>:
Extra info received and filed, but not forwarded. (Thu, 29 Jan 2009 10:36:08 GMT) (full text, mbox, link).


Message #19 received at 497540-quiet@bugs.debian.org (full text, mbox, reply):

From: David Paleino <d.paleino@gmail.com>
To: 497540-quiet@bugs.debian.org
Cc: Bash-Completion Developers <bash-completion-devel@lists.alioth.debian.org>, Yanko Kaneti <yaneti@declera.com>
Subject: procfs stores process name in a truncated form in /proc/<pid>/stat
Date: Thu, 29 Jan 2009 11:32:48 +0100
[Message part 1 (text/plain, inline)]
clone 497540 -1
reassign -1 src:linux-2.6
retitle -1 "procfs stores process name in a truncated form in /proc/<pid>/stat"
thanks

On Thu, 22 Jan 2009 00:13:39 +0200, Yanko Kaneti wrote:

> It would be nice if this worked but current release of procps trim the
> command name to 15 even if the ps comm  column is specified with
> additional width.  And these days there are many commands with names
> longer than 15  e.g. gnome-blah-blah..

Hello,
while fixing #497540 we stumbled upon a bug in procps. Trying to fix completion
for "killall", we wanted to use "ps axo comm" instead of "ps axo command", but
that truncates process names at 15 characters. It could've been a procps bug,
but the truncated form is really stored in /proc/<pid>/stat:

# cat /proc/12571/stat
12571 (hald-addon-stor) S 12519 12518 12518 0 -1 4194304 347 0 0 0 4 0 0 0 20 0
1 0 520073 3391488 260 4294967295 134512640 134528780 3220600864 3220600436
3084521718 0 0 4097 0 0 0 0 17 0 0 0 0 0 0
#

(that should've really been "hald-addon-storage")

This obviously breaks a number of applications depending on procfs to get the
process name.

Is there a reason for this 15-characters-limitation?

Kindly,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Bash Completion Maintainers <bash-completion-devel@lists.alioth.debian.org>:
Bug#497540; Package bash-completion. (Thu, 29 Jan 2009 19:57:02 GMT) (full text, mbox, link).


Acknowledgement sent to "Santiago M. Mola" <cooldwind@gmail.com>:
Extra info received and forwarded to list. Copy sent to Bash Completion Maintainers <bash-completion-devel@lists.alioth.debian.org>. (Thu, 29 Jan 2009 19:57:02 GMT) (full text, mbox, link).


Message #24 received at 497540@bugs.debian.org (full text, mbox, reply):

From: "Santiago M. Mola" <cooldwind@gmail.com>
To: 497540@bugs.debian.org
Date: Thu, 29 Jan 2009 20:53:11 +0100
[Message part 1 (text/plain, inline)]
I can't reproduce the original issue. The old code:
  ps axo command | sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | sed -e
"s/.*\///"
outputs dbus-daemon correctly.

Could someone post the 'ps axo command' output from Debian? Can anyone
actually confirm the original bug?

By the way, both the old and new code get some commands wrong (noticed
those '0' and '1' one the completion?). Something like this might work
better:
  ps axo command |sed -e "1d; s: .*$::g; s:^/.*/::g; s/:$//g; s:^-::g;
s:^\[::g; s:\]$::g; s:/.*::g"
[signature.asc (application/pgp-signature, inline)]

Tags set to: unreproducible, wontfix Request was from David Paleino <d.paleino@gmail.com> to control@bugs.debian.org. (Thu, 29 Jan 2009 20:30:03 GMT) (full text, mbox, link).


Bug closed, send any further explanations to Fabian Bieler <der.fabe@gmx.net> Request was from David Paleino <d.paleino@gmail.com> to control@bugs.debian.org. (Thu, 29 Jan 2009 20:30:05 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Fri, 27 Feb 2009 07:30:42 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jul 2 05:48:29 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.