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
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#64954: GNU 'uptime' on OpenBSD always prints "0 users"
which was filed against the coreutils package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 64954 <at> debbugs.gnu.org.
--
64954: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64954
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Thanks, I propagated that into Coreutils and installed the simplified
patch I mentioned yesterday. Closing the coreutils bug report.
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
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.
[freebsd-13.2-config.h (text/x-chdr, attachment)]
[0001-uptime-Print-the-correct-number-of-users-on-OpenBSD.patch (text/x-patch, attachment)]
This bug report was last modified 2 years and 8 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.