GNU bug report logs -
#64954
GNU 'uptime' on OpenBSD always prints "0 users"
Previous Next
Reported by: Bruno Haible <bruno <at> clisp.org>
Date: Sun, 30 Jul 2023 14:45:01 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 64954 <at> debbugs.gnu.org (full text, mbox):
On 30/07/2023 15:44, Bruno Haible wrote:
> Hi,
>
> GNU coreutils-9.3 'uptime', on OpenBSD 7.2, prints
>
> 16:24:53 up 14 days 13:33, 0 users, load average: 0.04, 0.44, 0.59
>
> whereas the OpenBSD /usr/bin/uptime prints
>
> 4:24PM up 14 days, 13:33, 1 user, load averages: 0.04, 0.44, 0.59
>
> The utmp file contain these entries:
>
> Time (GMT) User PID Term Exit Boot User Process
> ------------------- --------------- ---------- ---- ---- ---- ------------
> 1970-01-01 00:00:00 0 0 0
> 1970-01-01 00:00:00 0 0 0
> 2023-07-16 00:52:00 bruno 0 0 0
>
> The readutmp.h code, in particular the IS_USER_PROCESS macro, works fine.
> (UT_TYPE_USER_PROCESS (U) expands to 0, and UT_TYPE_NOT_DEFINED expands to 1.)
>
> The problem is that the readutmp code is entirely disabled on this platform.
> Which is not appropriate.
>
> When I revert the coreutils commit 2984e47c789ebc39f55a3b1cb20b943de88eeedc,
> the coreutils 'uptime' program prints "1 user", as expected.
>
> The rationale of that commit was wrong:
> "Following gnulib commit 9041103 HAVE_UTMP_H will always be defined."
> No, what that gnulib commit did is to create an <utmp.h> replacement
> if the package imports the 'login_tty' module. But the HAVE_UTMP_H
> is *still* only defined if the platform provides it.
> Proof: On FreeBSD 13.2, which does not have <utmp.h> (it has <utmpx.h>
> instead), configuring coreutils-9.3 produces the attached config.h,
> which has
>
> #define HAVE_UTMPX_H 1
> /* #undef HAVE_UTMP_H */
>
> So, find attached the fix of the bug.
I'm fine with the change, but we'll also need to adjust
the sc_prohibit_always_true_header_tests syntax check in gnulib
as that will fail since gnulib/lib/utmp.in.h is present
and thus use of HAVE_UTMP_H is disallowed.
cheers,
Pádraig
This bug report was last modified 1 year and 356 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.