Bug 75002 - ps -ef shows uid not username
ps -ef shows uid not username
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: procps (Show other bugs)
7.3
i686 Linux
medium Severity low
: ---
: ---
Assigned To: Alexander Larsson
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-03 11:27 EDT by ethane
Modified: 2007-04-18 12:47 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-10-03 11:27:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description ethane 2002-10-03 11:27:16 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 
1.0.3705)

Description of problem:
When issuing "ps" commands, such as ps -ef usernames that are longer than 8 
characters show as a uid, instead of an username.  Other utilities such 
as "top", or "id" display correctly. Example:
--------------------
[kabdullah@myhost kabdullah]$ ps -ef
Snip-->
1974      1717  1713  2 08:21 pts/0    00:00:00 -bash
1974      1757  1717  0 08:21 pts/0    00:00:00 ps -ef
<--Snip
[kabdullah@myhost kabdullah]$ id
uid=1974(kabdullah) gid=100(users) groups=100(users)
------------------

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


How reproducible:
Always

Steps to Reproduce:
1.Create account longer then 8 characters
2.Login as said account
3.Issue "ps -ef | grep bash"
4.Notice uid, not username in first column

Actual Results:  n/a

Expected Results:  n/a

Additional info:

I originally believed it to be an NIS incompatibility, since this user is an 
NIS user, from a Solaris server.  But I created a local username "username2", 
and found the same behavior.
Comment 1 Alexander Larsson 2002-10-08 10:00:32 EDT
This is a feature, not a bug. If you're parsing ps output you can't rely on a
username if it can be truncated, so it's printed as a uid instead.
Comment 2 Kevin M. Myer 2002-11-12 10:48:52 EST
So let me see if I have this logic right:

if uid<=8, display username,
else display numeric uid.

If I'm parsing ps output, I'd say returning a numeric uid is just as bad as
returning a truncated username (in other words, the whole USER field can't be
relied on in ps output, unless usernames are less than 8 characters).  Since
you're not enforcing an 8 character username anywhere that I can find, it would
seem that the proper response would be to modify ps to support >8 character
usernames.  If I'm not mistaken, useradd supports usernames up to 256
characters.  What am I missing here??

At the very least, I'd like to see a command line option to force display of >8
character usernames.  Ideally, I'd like to see the USER column expanded to at
least 16 characters (actually making it dynamically grow to the length of the
longest username would be great but I know terminals are only 80 characters wide
too...)  Times have changed - its unreasonble to believe that usernames are < 8
characters so lets update our utilities output and embrace that fact :)

If the problem is that scripts will break, then quoting from the procps NEWS:

"Scripts that make assumptions about character position are and
were broken because fields may overflow. Scripts should parse by
whitespace and use -o to get the best results."

My sentiments exactly..

Kevin (who just wants to easily see who has a connection to our netatalk server
by running ps, instead of having to run ps, then do an ldapsearch for that
numeric uid...)

PS:  Anyone perusing these reports who wants to see more of the username, simply
patch procps-2.0.X/ps/output.c:  find the line that reads {"user",      "USER",
   pr_euser,    sr_euser,   8,   0,    U98, USER}, /* BSD n forces this to UID */

and change the 8 to whatever length you want the username to appear as.  You
might have to use the "w" switch with ps to get wide screen output as the
command field might get truncated but this is far better for me than the current
behaviour - hrm feature request for 8.1??
Comment 3 Alexander Larsson 2002-11-12 12:05:25 EST
If you really want this you have to ask for an opinion upstream. Mail to
procps-list@redhat.com. (More info at http://www.surriel.com/procps/).

I can't make these kind of changes in the stuff i package. It would make it
incompatible with upstream.



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