Project:Toolchain/time64 migration

From Gentoo Wiki
Jump to:navigation Jump to:search

Mixing 32-bit time_t and 64-bit time_t is a recipe for disaster where time_t is exposed in a public API and the consumer/provider are mismatched e.g. net-misc/wget with net-libs/gnutls in bug #828001.

For 32-bit arches, we need to coordinate flipping glibc systems over to use 64-bit time_t using CPPFLAGS="-D_TIME_BITS=64" (note that not all packages may support/respect CPPFLAGS).

Obviously 64-bit arches are already fine.

Notes in no particular order:

  • Support is new in glibc 2.34 which is still in ~arch, not stable.

See discussion on libc-alpha here too.

Plans

TODO

  • How do we safely recommend rebuilding?
    • Start with (some subset of?) @system then @world?
  • How do we identify mismatched systems (possibly musl)? Will they just need to follow the glibc procedure we decide on (sans flags)?

musl

  • musl upstream already migrated to pure 64-bit time_t in 1.2.0
  • Upstream notes
  • Need to check how/if at all we handled it in Gentoo
  • Check whether there's more work to be done to ensure user systems are in a consistent state
  • 1.2.0 was added on 2020-02-25 and 1.2.1 (first of 1.2.x) was stabled on 2020-08-20.
    • Possible user systems are in an inconsistent state given we've not rebuilt / news item'd for this?

LFS

  • We may want to compare with how Large File Support (LFS) / FILE_OFFSET_BITS has been handled
  • Much more mature support
  • bug #471102 tracks progress in Gentoo
  • Meson already adds this as required
  • autoconf has AC_SYS_LARGEFILE which things should be using (but may not be!)
  • We have append-lfs-flags (and filter-lfs-flags) in flag-o-matic.eclass

Possible solutions

Rebuild after profile change

  • In current profiles, set gl_cv_type_time_t_bits_macro=no to prevent gnulib autoconf macro from automatically adding -D_TIME_BITS=64 (done)
  • In new profile, add CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" (do CFLAGS instead given very little respects CPPFLAGS).
  • Advise users to adjust custom CPPFLAGS if necessary, and rebuild @world after switching profiles.

Revbump ebuilds

  • In packages where time_t is utilized, revbump and add append-cppflags -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64.
  • This doesn't ensure that libraries and their consumers get rebuilt together, but it should work out in the end.