public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH v3 2/3] login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701)
Date: Fri, 12 Apr 2024 14:23:59 -0700	[thread overview]
Message-ID: <1600e516-8a88-4ddb-af2f-3e29fd605592@cs.ucla.edu> (raw)
In-Reply-To: <ceb6950bb33af399460f48ea06214dd721e1b8b7.1712731247.git.fweimer@redhat.com>

On 2024-04-09 23:45, Florian Weimer wrote:
> diff --git a/sysdeps/x86/bits/wordsize.h b/sysdeps/x86/bits/wordsize.h
> index 70f652bca1..3f40aa76f9 100644
> --- a/sysdeps/x86/bits/wordsize.h
> +++ b/sysdeps/x86/bits/wordsize.h
> @@ -8,10 +8,9 @@
>   #define __WORDSIZE32_PTRDIFF_LONG	0
>   #endif
>   
> +#define __WORDSIZE_TIME64_COMPAT32 1
> +
>   #ifdef __x86_64__
> -# define __WORDSIZE_TIME64_COMPAT32	1
>   /* Both x86-64 and x32 use the 64-bit system call interface.  */
>   # define __SYSCALL_WORDSIZE		64
> -#else
> -# define __WORDSIZE_TIME64_COMPAT32	0
>   #endif

I'm still having a few qualms about this part of the patch, and 
similarly for ARM. To continue from an earlier round:

>> > 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.

It appears that I was not clear, as I was worried about applications 
built on 32-bit ARM or x86 without -D_TIME_BITS=64, so please let me try 
again.

For obsolescent 32-bit time_t apps that deal with 32-bit on-disk 
timestamps I see two forms of "consistent behavior":

A. These obsolescent apps should behave consistently with how they've 
behaved for decades.

B. These obsolescent apps should behave consistently with how 64-bit 
time_t apps work on the same platform for timestamps after 2038.

Surely consistency (A) is more important than consistency (B). As you 
mentioned, there are countless other reasons these obsolescent apps 
won't work after 2038, so consistency (B) has no value. In contrast, 
consistency (A) - which is essentially "don't fiddle with obsolescent 
apps" - has the value of stability.

In other words, because it's better to not disturb obsolescent apps, we 
should leave ut_tv.tv_sec alone when apps are built with 32-bit time_t, 
even on platforms where there is a 64-bit arch that is coinstallable.

  parent reply	other threads:[~2024-04-12 21:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10  6:45 [PATCH v3 0/3] login: Use unsigned 32-bit types for seconds-since-epoch Florian Weimer
2024-04-10  6:45 ` [PATCH v3 1/3] login: Check default sizes of structs utmp, utmpx, lastlog Florian Weimer
2024-04-12 16:14   ` Adhemerval Zanella Netto
2024-04-10  6:45 ` [PATCH v3 2/3] login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) Florian Weimer
2024-04-12 16:15   ` Adhemerval Zanella Netto
2024-04-12 21:23   ` Paul Eggert [this message]
2024-04-15  9:28     ` Florian Weimer
2024-04-17 21:14       ` Paul Eggert
2024-04-10  6:45 ` [PATCH v3 3/3] login: Use unsigned 32-bit types for seconds-since-epoch Florian Weimer
2024-04-12 16:19   ` Adhemerval Zanella Netto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1600e516-8a88-4ddb-af2f-3e29fd605592@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).