Bug 143838

Summary: ps -C only uses 1st 8 chars of command name
Product: Red Hat Enterprise Linux 3 Reporter: John S. Hendry <jhendry>
Component: procpsAssignee: Karel Zak <kzak>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-20 03:25:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 132991    

Description John S. Hendry 2004-12-29 17:49:00 UTC
Description of problem:

The "ps -C" command only matches on the first 8 chars of the command
it is given to check.

Version-Release number of selected component (if applicable):

Red Hat 7.3 and Red Hat Enterprise Linux v3. 

How reproducible: 100% (bash or tcsh)

Steps to Reproduce: (bash example given)

1. Make the following 2 shell scripts:

$ ls -l
total 8
-rwxrwxr-x    1 jhendry  sdss           32 Dec 29 11:21 psTest_1
-rwxrwxr-x    1 jhendry  sdss           32 Dec 29 11:21 psTest_10
$
$ cat psTest_1
#!/usr/local/bin/bash
sleep 100
$
$ cat psTest_10
#!/usr/local/bin/bash
sleep 100
$

2. Run them both in the background simultaneously:

$ for x in $(ls);do ./$x&
> done
[1] 1087
[2] 1088
$

3. Enter an "ps -C" for either of the two scripts OR
   for any name sigificant AFTER the first 8 chars:

Actual results:

$ ps -C psTest_10
  PID TTY          TIME CMD
 1087 pts/0    00:00:00 psTest_1
 1088 pts/0    00:00:00 psTest_10
$

$ ps -C psTest_123456     
  PID TTY          TIME CMD
 1087 pts/0    00:00:00 psTest_1
 1088 pts/0    00:00:00 psTest_10
$ 


Expected results:

$ ps -C psTest_10
  PID TTY          TIME CMD
 1088 pts/0    00:00:00 psTest_10
$ 

$ ps -C psTest_123456     
  PID TTY          TIME CMD
$

Additional info:

Our machines include both Redhat 7.3 and Redhat Enterprise Linux.
The same problem occurs on both platforms.
The same problem occurs whether running bash or tcsh.

On Redhat 7.3
$ ps --version
procps version 2.0.7
$

On Redhat Enterprise Linux
$ ps --version
procps version 2.0.13
$

Comment 1 Karel Zak 2004-12-30 08:19:58 UTC
Yes, your're right there is 8bytes limit. The latest version of procps
has 16bytes limit for this. I think it should be works without
limits... I will prepare a patch for this.

Comment 3 Albert Cahalan 2005-01-05 19:19:07 UTC
The kernel only provides 15 characters to work with.
Recent procps releases use all of this.

Comment 4 Dennis Gregorovic 2005-05-20 03:25:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-156.html