bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64937: "who" reports funny dates


From: Bruno Haible
Subject: bug#64937: "who" reports funny dates
Date: Wed, 02 Aug 2023 01:40:23 +0200

> Here are the changes I committed in gnulib.

And here are the proposed changes for coreutils. Tested on a Fedora Rawhide
system, prepared from
https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-Rawhide-20230729.n.0.iso

The user-visible changes introduced by this change (when linking with
libsystemd) are, as far as I can see:

* "uptime", "users", "who -q" reports fewer users (because ptys without login
  are not counted).
* "who -d" does not report anything any more.
* "who -r" does not report anything any more.
* "who -t" does not report anything any more.
* "who -u" does not report ptys without login any more. The order is arbitrary. 
Example:
Without systemd:

bruno    seat0        2023-07-30 11:25   ?          1663 (login screen)
bruno    tty2         2023-07-30 11:25  old         1663 (tty2)
bruno    pts/3        2023-08-01 01:36 22:33       30619 (:0)
other    pts/4        2023-08-01 17:19 06:50       40513 (::1)

With systemd:

other    sshd pts/4   2023-08-01 17:19 06:50       40513 (::1)
bruno    seat0        2023-07-30 11:25   ?          1593
bruno    tty2         2023-07-30 11:25  old         1593

* pinky $USER
does not report a host any more (and thus does not spend time trying
to do a DNS lookup of "login screen" and "tty2"). Example:
Without systemd:

Login    Name                 TTY      Idle   When             Where
bruno    Bruno Haible        ?seat0    ?????  2023-07-30 11:25 login screen
bruno    Bruno Haible         tty2     2d     2023-07-30 11:25 tty2
bruno    Bruno Haible         pts/3    22:39  2023-08-01 01:36 :0

With systemd:

Login    Name                 TTY      Idle   When             Where
bruno    Bruno Haible        ?seat0    ?????  2023-07-30 11:25
bruno    Bruno Haible         tty2     2d     2023-07-30 11:25


The proposed patch is attached.

Note: Instead of the idiom

   #ifdef UT_HOST_SIZE
     (code for bounded ut_host)
   #else
     (code for unbounded ut_host)
   #endif

one could also write

   if (UT_HOST_SIZE >= 0)
     {
       (code for bounded ut_host)
     }
   else
     {
       (code for unbounded ut_host)
     }

It's just a matter of style whether one prefers #ifs or implicit dead code.

Attachment: 0001-maint-Update-after-gnulib-module-readutmp-changed.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]