public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Kaz Kylheku <kaz@kylheku.com>, libc-alpha@sourceware.org
Subject: Re: Best practices in regard to -D_TIME_BITS=64
Date: Tue, 4 Jan 2022 16:49:17 -0800	[thread overview]
Message-ID: <33e9ae8d-8b29-19d9-8747-cb8e96490205@cs.ucla.edu> (raw)
In-Reply-To: <b620104d84ebc36bd9f3d72a9b88d446@mail.kylheku.com>

On 1/4/22 15:33, Kaz Kylheku via Libc-alpha wrote:

> My main concern is specifically with application developers. Should
> individual applications be detecting that this is available and using it?

Yes, that's what we're doing with applications that use Gnulib. The 
Gnulib 'largefile' module morphed from its original goal of having apps 
be able to access files larger than 2 GiB, to the more-modern goal of 
being able to access files whose sizes, device numbers, inode numbers, 
and/or timestamps exceed traditional limits. Applications using the 
'largefile' module (and pretty much every Gnulib-using application uses 
the 'largefile' module) now get 64-bit time_t by default, on platforms 
that have 64-bit time_t.


> I have some apprehensions about just pulling the trigger and using it
> individually; like what if the application is included in some system
> where it is the only thing requesting that, and it causes some
> interoperability issue with other pieces.

Gnulib has behaved this way since July, and this behavior appears in the 
latest versions of coreutils, diffutils, grep, gzip and perhaps others. 
As far as I know, nobody's reported problems yet. That's of course not 
to say there won't be problems.


> One can force downstream people to deal with this. If the program
> detects that it's on a 32 bit platform where time_t is still 32 bits
> if no special compiler options are used, and where -D_TIME_BITS=64
> is available and working, the configure script can fail and make
> the user explicitly decide what they want to do: stick with the
> 32 bit time, or go to 64.

We didn't bother doing that with Gnulib; we just went with 64-bit time_t 
if available, 32-bit time_t if not.

Last year we did add a Gnulib module 'year2038' that causes 'configure' 
to fail by default if time_t is 32-bit; configurers can override that 
with './configure --disable-year2038' so that 'configure' will succeed 
even if time_t is 32-bit. Coreutils uses this module, since we didn't 
want people to build 32-bit time_t core utilities unless they explicitly 
wanted them.

People who build or use libraries that expose time_t to the API will 
likely have more issues than the abovementioned packages (time_t is like 
off_t and ino_t in that regard).


> A program not manipulating large files never needs to
> care, even if it manipulates files

Such a program will need to care, if it's compiled with 32-bit off_t and 
is linked to a 64-bit off_t library that exposes off_t to the API. 
time_t is no different from off_t here.

  reply	other threads:[~2022-01-05  0:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 23:33 Kaz Kylheku
2022-01-05  0:49 ` Paul Eggert [this message]
2022-01-05  0:53   ` Sam James
2022-01-05  4:43     ` Paul Eggert
2022-01-05 20:12       ` Kaz Kylheku

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=33e9ae8d-8b29-19d9-8747-cb8e96490205@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=kaz@kylheku.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).