Subject: Re: bug#73928: Bug#1080330: coreutils: who no longer works

From: Bruno Haible <[email-masked]>
Date: Mon, 17 Feb 2025 09:12:31 +0100

Paul Eggert wrote:
> If I configure current (f2e323430193956709aacca33f6b4fcab4fb9d8b) 
> Coreutils with --enable-systemd on my Ubuntu 24.10 desktop, the output 
> gets worse:
> 
>    $ ./who-no-systemd # Configured normally.
>    eggert   seat0        2025-02-15 10:11 (login screen)
>    eggert   tty2         2025-02-15 10:11 (tty2)
>    $ ./who-with-systemd # Configured with --enable-systemd.
>    eggert   seat0        2025-02-15 10:11
>    eggert   tty2         2025-02-15 10:11
> 
> Apparently for coreutils, /var/run/utmp (the traditional interface) has 
> more info than libsystemd's API.

Both outputs are equivalent; the second one is less redundant.
  - The comment "(tty2)" is redundant because it's already the tty.
  - The comment "(login screen)" is redundant because that's the
    concept of a "seat".

> Similarly, on a Fedora 41 desktop where I'm not currently logged in, I 
> get inferior results when Coreutils is configured with --enable-systemd:
> 
>    $ ./who-no-systemd
>    eggert   pts/3        2025-02-16 22:56 (47.147.225.25)
>    $ ./who-with-systemd
>    gdm      seat0        2025-02-13 18:04
>    gdm      tty1         2025-02-13 18:04
>    eggert   sshd pts/3   2025-02-16 22:56 (47.147.225.25)
> 
> Here, though I'm logged in only via ssh, the libsystemd-using 'who' 
> incorrectly reports that a user named "gdm" is logged in in person.

'who' merely reports the info it got from systemd-logind, and systemd-logind
most probably got a notification from gdm.

I agree with you that this _looks_like_ as if a user named 'gdm' was logged
in, and thus is misleading. But I don't think this should be fixed in
coreutils. Rather, this is something to work out between systemd-logind
and gdm.

Bruno