Bug 1070404
| Summary: | Allow longer usernames to display in ps output | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Andy Grimm <agrimm> | ||||
| Component: | procps | Assignee: | 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.5 | CC: | 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
Andy Grimm
2014-02-26 18:01:59 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. 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
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.
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. Development Management has reviewed and declined this request. You may appeal this decision by reopening this request. |