[PATCH] login: Use unsigned 32-bit types for seconds-since-epoch
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Fri Apr 5 13:32:57 GMT 2024
On 05/04/24 09:52, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
>
>> On 04/04/24 02:09, Florian Weimer wrote:
>>> * Paul Eggert:
>>>
>>>> On 4/3/24 11:39, Florian Weimer wrote:
>>>>> For consistency,
>>>>> if there is a 64-bit architecture that is coinstallable, define
>>>>> __WORDSIZE_TIME64_COMPAT32 to 1 on the 32-bit architectyre as well.
>>>>
>>>> Could you explain the advantage of consistency here? User code almost
>>>> invariably assignes ut_tv.tv_sec to time_t (this is true of every
>>>> instance I found of ut_tv in Gnulib source code, for example). So
>>>> changing this field's type on platforms where time_t is 32 bits will
>>>> likely be ineffective in practice, and might cause more problems than
>>>> it cures.
>>>
>>> Few applications with a 32-bit time_t will work once there is a value in
>>> this field with the MSB set. So the relevant case is applications that
>>> were built with -D_TIME_BITS=64, and there the consistent behavior with
>>> the 64-bit architecture helps.
>>
>> This helps only architectures with __WORDSIZE_TIME64_COMPAT32, so it does
>> not really solve the issue for all legacy platforms.
>
> We can add more __WORDSIZE_TIME64_COMPAT32=1 definitions.
>
>> I still prefer if we just deprecate this whole interface, since from
>> other legacy ABI history (non-LFS interface) programs will keep using
>> it until something breaks.
>
> I don't disagree, I just want to give distributions the option to
> backport a reviewed patch with a workaround that appears not to require
> much application porting. I believe many of us are preparing toolchains
> for distributions that are running close to the 2038 cliff.
So maybe add deprecated on utmp/utmpx functions, along with a NEWS entry
stating these function will make noop in future glibc release?
More information about the Libc-alpha
mailing list