Bug 1324553 - ps does not resolve UID to usernames
Summary: ps does not resolve UID to usernames
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: procps
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jan Rybar
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-06 15:36 UTC by Jaroslav Kortus
Modified: 2016-08-26 10:55 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-26 10:55:41 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Jaroslav Kortus 2016-04-06 15:36:28 UTC
Description of problem:
ps auxfw does not resolve all UIDs to usernames. In my output it looks like this:

[root@virt-014 ~]# ps auxfw | grep -E '^[0-9]'
68        1503  0.0  0.3  37852  3728 ?        Ssl  Apr04   0:01 hald
68        1546  0.0  0.1  18008  1108 ?        S    Apr04   0:00      \_ hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
189      11541  0.1  1.3  98076 13676 ?        Ss   Apr04   3:14  \_ /usr/libexec/pacemaker/cib
189      11544  0.0  0.3  85504  3728 ?        Ss   Apr04   0:23  \_ /usr/libexec/pacemaker/attrd
189      11545  0.0  0.2  80944  2840 ?        Ss   Apr04   0:22  \_ /usr/libexec/pacemaker/pengine
[root@virt-014 ~]# grep 68 /etc/passwd
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
[root@virt-014 ~]# grep 189 /etc/passwd
hacluster:x:189:189:cluster user:/home/hacluster:/sbin/nologin
[root@virt-014 ~]# id hacluster
uid=189(hacluster) gid=189(haclient) groups=189(haclient)
[root@virt-014 ~]# id haldaemon
uid=68(haldaemon) gid=68(haldaemon) groups=68(haldaemon)


Version-Release number of selected component (if applicable):
procps-3.2.8-36.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. ps auxfw and look for numbers in the first column
2.
3.

Actual results:
numbers appear occasionally instead of usernames

Expected results:
usernames, no numbers as long as the user is "resolvable"

Additional info:

Comment 2 Jan Rybar 2016-07-21 15:18:55 UTC
I was able to reproduce this issue on RHEL6, but not on RHEL7 nor Fedora 23. I will investigate this. If this shows up as RHEL6-only issue, I will not propose this to upstream.

Comment 3 Jan Rybar 2016-08-26 10:55:41 UTC
The explanation is this:
In RHEL6 version of ps, the "effective user name" field is 8 chars long. As 'haldaemon' retrieved from passwd exceeds this limitation, it is, like in any other such cases, substituted with EUID (68 in this case).
In RHEL7 procps (massively rewritten), the name of effective user is shortened and appended with '+' to fit the field. In this case it would look 'haldaem+'.

A note is present in manual page of ps, section STANDARD FORMAT SPECIFIERS, item 'euser', describing this behavior.

Change to RHEL7-like behavior would bring a risk that other users' scripts depending on this might break.


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