Skip to content

w: Shows incorrect value in the WHAT column #665

@alxndrv

Description

@alxndrv

There is a discrepancy in the information output by this implementation of w and the reference implementation:

$ cargo run -q w  
 21:22:38 up  1:06,  1 user,  load average: 0.09, 0.27, 0.58
USER     TTY       LOGIN@   IDLE   JCPU   PCPU  WHAT
alx      tty1      20:16    1:06m  0.00   0     /bin/sh/usr/bin/niri-session-l

$ w
 21:22:38 up  1:06,  1 user,  load average: 0.09, 0.26, 0.58
USER     TTY       LOGIN@   IDLE   JCPU   PCPU  WHAT
alx      tty1      20:16    1:06m  0.00s   ?    systemctl --user --wait start niri.service
  1. The value of WHAT seems to be stripping away all whitespace from the command it's trying to display.
    /bin/sh/usr/bin/niri-session-l is clearly supposed to be this shell script invocation: /bin/sh /usr/bin/niri-session -l

  2. The actual content of the column refers to two slightly different steps in the invocation chain.
    In this specific case /usr/bin/niri-session is a bash script which is invoked by the display manager at login-time.
    systemctl --user --wait start niri.service is something that is called from inside this bash script.

Looking at these processes with ps, I can confirm that both are still running, and the /bin/sh invocation is indeed higher up in the invocation chain (it has a lower PID).
Seeing how there's two different processes being shown in the WHAT, I'd also assume that the PCPU values would also have a discrepancy if they anything else than zero 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions