> Date: Thu, 28 Aug 2025 12:27:03 -0400
> From: Michael Stone <[email protected]>
> To: g1 <[email protected]>, [email protected]
> Subject: Re: Bug#1112334: coreutils: systemd integration broke "who" in
>  trixie/sysvinit --- workaround
> 
> On Thu, Aug 28, 2025 at 05:18:12PM +0200, g1 wrote:
> > Upstream made a number of decisions that IMHO are not very brilliant:
> 
> upstream didn't have a lot of options. I was in the same position, because
> even though I thought dropping utmp for trixie was a mistake, it happened
> anyway and even though some utilities are still writing utmp entries, most
> are not. I really wish that trixie had supported both options, but when
> systemd changed unilaterally this outcome was forced.

Upstream _had_ options, some very simple to implement, like this

--- lib/readutmp.c.bak  2025-08-28 19:50:43.489848372 +0200
+++ lib/readutmp.c      2025-08-28 19:51:13.523664432 +0200
@@ -982,7 +982,7 @@
            int options)
 {
 # if READUTMP_USE_SYSTEMD
-  if (strcmp (file, UTMP_FILE) == 0)
+  if (strcmp (file, UTMP_FILE) == 0 && getenv("WHO_USE_FILE") == NULL)
     /* Imitate reading UTMP_FILE, using systemd and Linux APIs.  */
     return read_utmp_from_systemd (n_entries, utmp_buf, options);
 # endif

or this

--- lib/readutmp.c.bak  2025-08-28 19:50:43.489848372 +0200
+++ lib/readutmp.c      2025-08-28 19:59:17.748453546 +0200
@@ -982,7 +982,8 @@
            int options)
 {
 # if READUTMP_USE_SYSTEMD
-  if (strcmp (file, UTMP_FILE) == 0)
+    struct stat sb;
+  if (strcmp (file, UTMP_FILE) == 0 && stat("/run/systemd/system", &sb) == 0)
     /* Imitate reading UTMP_FILE, using systemd and Linux APIs.  */
     return read_utmp_from_systemd (n_entries, utmp_buf, options);
 # endif

Of course, once one accepts that the only way to look at Linux is
through the Systemd lens, are bets are off.  The outcome is not just
that a bunch of utilities that people used to rely on don't work anymore
or are defective: a lot of things that once were trivial have become
unnecessarily complex, with a much wider attack surface.  The lesson
from the xz incident has been forgotten.

Would you mind to reopen this bug and keep it open for a while, so that
people can at least see there's a workaround?

Regards,
    g.b.

Reply via email to