64-bit time_t and __WORDSIZE_TIME64_COMPAT32

Thorsten Kukuk kukuk@suse.com
Wed Apr 12 06:55:01 GMT 2023


On Tue, Apr 11, Paul Eggert wrote:

> On 4/11/23 04:40, Thorsten Kukuk via Libc-alpha wrote:
> 
> > wtmp: see https://www.thkukuk.de/blog/Y2038_glibc_wtmp_64bit/
> > 
> > Even if many applications write wtmp entries in a chaotic or wrong way,
> > there is only one application from relevance reading it: last.
> 
> Also, coreutils "who", "users", "pinky", and "uptime", e.g., the shell
> command:

At least "pinky" does not read wtmp but utmp.
For the rest: there are better ways to find out how many users are
logged in (utmp) or how many entries wtmp has...
I don't understand for what this should be good? It's absolute
meaningless how many old records wtmp contains, it depends on when
logrotate did the last cleanup...

> who /var/log/wtmp

That's the equivalent of "last". Since there will be no wtmp anymore, you
have to use "last" (gives you the same informations) or we have to
implement wtmpdb support into who. Don't know if this makes really
sense.

> which is used on occasion (e.g., <https://linuxhandbook.com/who-command/>).
> 
> 
> > For coreutils patches exist beside who
> 
> <https://www.thkukuk.de/blog/Y2038_glibc_utmp_64bit/> points to
> <https://github.com/thkukuk/utmpx/tree/main/coreutils> which 404s. So I
> assume you're talking about
> <https://github.com/thkukuk/utmpx/tree/main/patches/coreutils>? These are
> proof-of-concept (e.g., "who" needs patching).

Correct, things are moving faster than I'm able to update the blog...

The patches are WIP in the regard they are tested and working, but since I
don't understand how the coreutils configure framework works that is
missing. I have already a working "who", I just need some more time for
cleanup. I had to work on other tasks first.

And since there will be no "utmp" and "wtmp" files anymore, there is no
need to support reading them. 

> Also, will the decision about whether the old or new format is used be
> something that the coreutils builder knows at compile time? or will it be
> something switchable by the ops staff at runtime, so (e.g.) "who" should be
> prepared to read either format?

As you can see from the patches it's currently either systemd or
utmp/wtmp, not both. libsystemd does not always return an error if
systemd-logind is not used (or I haven't found out yet how to test for
that, needs more time), so this is hard to decide at runtime.

But to be honest: I doubt that people will compile their userland
applications with systemd support and use it on systems without systemd:
libsystemd does not seem to be designed for that use case, so will create
more problems than anything else, should be already the case with other
already existing tools, too.

  Thorsten

-- 
Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies
SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nuernberg, Germany
Managing Director: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman
(HRB 36809, AG Nürnberg)


More information about the Libc-alpha mailing list