Bug 1127909

Summary: 'w' command aligns the colums incorrectly
Product: Red Hat Enterprise Linux 7 Reporter: giulioo
Component: procps-ngAssignee: Jan Rybar <jrybar>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: jkejda, kdudka, lmiksik, ovasik
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-27 14:53:28 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: 1078310    
Bug Blocks:    
Attachments:
Description Flags
procps-ng-3.3.10-w-from-column-aligment.patch none

Description giulioo 2014-08-07 19:46:13 UTC
Description of problem:

Up to RHEL6, if you used the command
	$ w
you would automatically get the "FROM" column in the output.

Starting with RHEL7
	$ w
will omit the "FROM" column.

You think, ok, let me use some explicit cmd line option so that the script I'm using on RHEL5/6 will work the same on RHEL5/6 and 7.

Alas, this is not possible:

on RHEL5/6
	$ w -f
will take out the "FROM" column

on RHEL7
	$ w -f
will add the "FROM" column.

When the w's manual says "-f will TOGGLE" it means it literally :(

So, both "w" and "w -f" produce opposite outputs on RHEL7 with regards to previous RHEL versions.

On rhel6 the spec file had: W_SHOWFROM=-DW_SHOWFROM
On rhel7 it has   --disable-w-from

====
Minor issue, on RHEL7, when using "-f", the column labels get misaligned by 1 char (1 space missing between "FROM" label and "LOGIN@" label).




Version-Release number of selected component (if applicable):
procps-ng-3.3.9-6.el7.x86_64

Comment 2 Jaromír Cápík 2014-08-07 20:30:14 UTC
Hello Giulioo.

The w FROM issue has already been reported internally in scope of Bug 1078310. But the minor issue with column alignment you mentioned is something I never noticed before. Good catch. I'll fix that upstream and then backport/rebase in scope of RHEL7.

Thanks for the report.

Regards,
Jaromir.

Comment 5 Jaromír Cápík 2016-01-14 15:06:30 UTC
Created attachment 1114841 [details]
procps-ng-3.3.10-w-from-column-aligment.patch

Comment 8 Jan Rybar 2017-04-10 14:28:55 UTC
After testing the patch uploaded above I noticed that fixing one space makes another misalignment if user tries another w's option (-s for example).
Because the spaces in headline are mostly hardcoded (!!!) even within upstream version, it is like hit-a-mole game.
The entire headline space computation should be reconsidered to be more dynamic, which may exceed the scope of this BZ.