Re: mismatch of type of ut_tv.tv_sec between glibc-2.41 and utmp(5)

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

 



Hi Thomas,

On Mon, Mar 03, 2025 at 10:31:01AM +0100, Dr. Thomas Orgis wrote:
> Am Fri, 28 Feb 2025 15:06:33 +0100
> schrieb Alejandro Colomar <alx@xxxxxxxxxx>:
> 
> > It seems your suspicion was right.  Someone decided to borrow some time,
> > according to the commit message that changed that code in glibc:
> 
> > We should document the change.  If anyone wants to send a patch, I'll
> > review it.  I won't write it myself, because I'm not an expert in
> > compatibility code between 32 and 64 bits, so I prefer if someone more
> > expert makes sure the documentation is correct.
> 
> Florian? Seems to be the best qualified. As a user, a question for me
> is if the specific macros deciding for the 32 bit field should be in
> the man page or not, as they seem to be an implementation detail that
> one cannot rely on. I guess I need to do a check like sizeof(time_t) >
> sizeof(tv_sec)? And then just assume unsigned type? It is a hack, I
> understand. So any use will be hacky.

Hmmm, this reminds me of timespec(3type).  Maybe we can document it
similarly here.  Feel free to inspire on that page for a patch (you or
Florian).

> > If you show some code, we can have a look at it.  :)
> 
> Not much to show. It is semi-abandoned code in simpleinit-msb that
> called time() directly on tv_sec. I switched that to gettimeofday() and
> kept the same level of error handling … which is none. My function
> detects if the assignment to tv_sec changed the time_t value and
> returns an error, but the caller code is inside void functions and
> doesn't have an error handling path.
> 
> The effect will be broken lastlog entries in a few decades. The
> unsigned int extension moves that a bit further back.

Thanks for the details!


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux