Bug 1127909 - 'w' command aligns the colums incorrectly
Summary: 'w' command aligns the colums incorrectly
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: procps-ng
Version: 7.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Jan Rybar
QA Contact: qe-baseos-daemons
Depends On: 1078310
TreeView+ depends on / blocked
Reported: 2014-08-07 19:46 UTC by giulioo
Modified: 2019-03-27 14:53 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-03-27 14:53:28 UTC

Attachments (Terms of Use)
procps-ng-3.3.10-w-from-column-aligment.patch (483 bytes, patch)
2016-01-14 15:06 UTC, Jaromír Cápík
no flags Details | Diff

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):

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.


Comment 5 Jaromír Cápík 2016-01-14 15:06:30 UTC
Created attachment 1114841 [details]

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.

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