Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1070404

Summary: Allow longer usernames to display in ps output
Product: Red Hat Enterprise Linux 6 Reporter: Andy Grimm <agrimm>
Component: procpsAssignee: Jaromír Cápík <jcapik>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: albert, jgoulding, ovasik
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1112734 (view as bug list) Environment:
Last Closed: 2014-06-24 13:38:11 UTC Type: Bug
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: 1112734    
Attachments:
Description Flags
Patch to allow display of longer usernames none

Description Andy Grimm 2014-02-26 18:01:59 UTC
Description of problem:

Usernames in OpenShift are UUIDs, which user to be 32 characters and are now 24.  Currently, ps won't display a username longer than 20 characters (based on P_G_SIZE in proc/pwcache.h).  This has been problematic both for OpenShift code that uses ps and for sysadmin monitoring OpenShift nodes.  It would be great if we could set this to something >= 32.

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

procps-3.2.8-25.el6.x86_64

How reproducible:

Always

Steps to Reproduce:
1. useradd abcdefghijklmnopqrstuvwxyzabcdef
2. su - abcdefghijklmnopqrstuvwxyzabcdef -c "sleep 100 &"
3. ps -o user:40 -u abcdefghijklmnopqrstuvwxyzabcdef

Actual results:

ps display a 40-column "USER" field, but it contains the UID instead of the username.

Expected results:

ps should display the username if the specified column width is long enough.

Comment 2 Jaromír Cápík 2014-03-27 12:30:51 UTC
Hello Andy.

The whole width evaluation logic is strange.

Try this for example:
---------------------
ps -A -o user:1,pid
ps -A -o user:1

In the first case you only get UIDs, in the second case you get usernames (possibly mixed with UIDs).

I need to dig in the code and check how it is supposed to work as the manual isn't much helpful.

Thanks for the report.

Regards,
Jaromir.

Comment 3 Andy Grimm 2014-03-27 17:32:15 UTC
Sorry, I probably made this more confusing by getting the constant name wrong.  It's P_G_SZ , not P_G_SIZE.  in pwcache.c in user_from_uid, you'll see:

    if(!pw || strlen(pw->pw_name) >= P_G_SZ)
        sprintf((*p)->name, "%u", uid);
    else
        strcpy((*p)->name, pw->pw_name);


thus, if pw_name is larger than P_G_SZ , it will always use uid instead.  There are _other_ cases where it will display uid instead of username due to your formatting choice, but the absolute upper bound on the username length it will display is P_G_SZ

Comment 4 Andy Grimm 2014-06-10 15:07:21 UTC
Created attachment 907302 [details]
Patch to allow display of longer usernames

I've been testing this patch, and it works for my primary test case:

* useradd abcdef1234567890abcdef1234567890
* runuser -l abcdef1234567890abcdef1234567890
* ps -o user:40,pid,ppid,state,cmd

Result:

[abcdef0123456789abcdef1023456789@rhel6u5 ~]$ ps -o user:40,pid,ppid,state,cmd
USER                                       PID  PPID S CMD
abcdef0123456789abcdef1023456789          1659  1658 S -bash
abcdef0123456789abcdef1023456789          1682  1659 R ps -o user:40,pid,ppid,state,cmd


I don't know what other corner cases there may be, but it seems trivial.

Comment 6 Jaromír Cápík 2014-06-24 13:22:41 UTC
Hi Andy.

After doing some research here, I'm quite discouraged from doing changes of the P_G_SZ macro. The change seems to be trivial, but has huge consequences. It breaks the API compatibility as it changes the proc_t structure size and all custom software linked against the libproc library would start crashing after the upgrade.
Unless there's a big business impact, I'll rather not touch this at all. I'm discouraged to remove any symbols or modify sizes of structures.

Please, clarify the business impact. However, this change is not going to make it to RHEL6.6.

Regards,
Jaromir.

Comment 7 RHEL Program Management 2014-06-24 13:38:11 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.