#1037136 dpkg-buildflags: 64-bit time_t by default

Package:
dpkg-dev
Source:
dpkg-dev
Submitter:
Steve Langasek
Date:
2024-02-27 04:21:03 UTC
Severity:
normal
Tags:
#1037136#5
Date:
2023-06-06 04:18:10 UTC
From:
To:
Hi Guillem,

The discussion on debian-devel around 64-bit time_t has died down, so I
figure it's time to propose some patches to implement what's been discussed
there.

I'm not sure whether you were persuaded that i386 should stay with the
current ABI, but anyway thought I would propose the patches and we could
discuss further if necessary.

#1037136#10
Date:
2023-06-09 01:56:28 UTC
From:
To:
Hi!

Yeah, I'm not sure whether it has died off or it's just being slow.

In any case I've tried to reply there. Also my impression was that
there was still some analysis pending (perhaps that was a wrong
impression though)?

Thanks for the patches!

Ah, I actually had implemented locally the alias with your original
suggestion of "abi"! :) Using "feature" here seems would be rather
more confusing as these are called feature flags, and feature areas.

I'll try to push the stuff I've got queued locally during the weekend,
then I can rebase these patches on a branch or similar.

I'm not sure I like intermingling the different semantics here, if
necessary I'd rather make time64 forcibly enable another feature flag,
like it is done for lfs.

As I mentioned on the recent thread about the modern C stuff, I do
have a branch that adds these as part of a new qa=+c99 feature, but
that's too broad. :/

  <https://git.hadrons.org/git/debian/dpkg/dpkg.git/commit/?h=next/modern-c&id=3316845bf415436299d61501db655fd2c1813436>

Maybe I could add a new feature area instead and add the flags
individually, and then make time64 also enable that other specific
feature. Hmmm.

Thanks,
Guillem

#1037136#15
Date:
2023-07-05 21:24:02 UTC
From:
To:
Hi,

I wanted to check in on the status of this.

There is analysis pending, unfortunately 90% of the -dev packages have been
analyzed leaving 90% to go (~1600 -dev packages that require fixes to be
compilable and therefore analyzable).  I don't have any answer yet from the
Release Team, so I'm not sure if we need this analysis to be completely done
before starting the transition or if we can leave the long tail of packages
with 1 or 2 reverse-build-dependencies to be figured out later.

As far as I can tell, this hasn't been pushed anywhere yet?

Did you reach a decision here?  Anything you'd like from me to move this
forward?

Thanks,

#1037136#20
Date:
2023-07-09 18:06:56 UTC
From:
To:
Hi!

Ack, thanks. Is that last % supposed to be 10%? Otherwise I think I'm
missing something :).

I don't know. Perhaps ask on d-d?

Right, sorry got entangled in a local branch with random stuff, but
rebased that and added on top now several other fixes including these
changes or ones similar in intention. See at:

https://git.hadrons.org/git/debian/dpkg/dpkg.git/log/?h=next/time64-default

(Beware that I might rebase that branch, before merging it, although I
think I'll start pushing some of the foundation work into main already.)

I realized now that this cannot be set for CXXFLAGS as at least g++
will warn about that. And I've gone for now by depending on qa=+bug,
but I'm not sure whether that would cause too many regressions. OTOH
and AFAIK any such problem should be considered a genuine bug anyway,
so…

But if this is too much I guess I could split that warning into its
own feature and make both the qa=+bug and abi=+time64 depend on it
instead.

Thanks,
Guillem

#1037136#25
Date:
2023-12-20 07:33:47 UTC
From:
To:
Hi Guillem,

Coming back to this after a hiatus.  (In the intervening time the focus has
been getting the library ABI analysis right; now coming back around to
looking at the toolchain.)

A reference to https://en.wikipedia.org/wiki/Ninety%E2%80%93ninety_rule

Now that I've had a chance to look at the implementation, I am concerned
about abi=+time64 implying qa=+bug, because I see that this turns on
additional -Werror options beyond implicit-function-declaration:

        my @cfamilyflags = qw(
            array-bounds
            clobbered
            volatile-register-var
        );
        foreach my $warnflag (@cfamilyflags) {
            $flags->append('CFLAGS', "-Werror=$warnflag");
            $flags->append('CXXFLAGS', "-Werror=$warnflag");
        }

While these may all be bugs, forcing the fixing of bugs unrelated to the
time_t transition during the transition will inevitably slow down Debian
development, so I am concerned about having such a dependency.  We
unfortunately also haven't done any archive rebuild analysis on this to
understand how large the actual impact is (again, the focus has been on just
getting the analysis right of which packages do have an ABI change).

And while there's no specific timeline required on the Debian side yet, on
the Ubuntu side we have a tight timeline to get this all done in the next
couple of months so that it can be included in the 24.04 LTS release.

The idea of splitting it into a separate feature seems ok, to avoid turning
on unrelated -Werror options.

We still don't have a slot from the Release Team for when this can be
landed, but following up to debian-devel with a complete analysis of the
library ABIs is my next step before the end of year.  Is this a change you
think could be uploaded to dpkg on short notice?  Or would you be amenable
to an NMU, if you're unavailable for an upload?

#1037136#30
Date:
2023-12-20 23:18:50 UTC
From:
To:
Hi!

Ok, I'll prepare a patch this week to split it then.

Once the discussion is settled and the plan agreed, I think that will
also include agreeing on a date for all the involved uploads. TBH, I
don't expect that to be on short notice given all the parties that
might need to coordinate this, but I have no problem planning and
preparing an upload for a specific pre-agreed date. (And in case that
for some weird reason it would end up being on short notice I should
be able to manage too, I guess. :)

I also assume that with "this change" you refer to flipping the default
plus the -Werror flag stuff and not just the latter.

Regards,
Guillem

#1037136#35
Date:
2024-02-05 14:50:59 UTC
From:
To:
Hi John, thanks for getting back!

I'm sorry for the confusion, this time_t ABI transition is a special snowflake,
as timing is crucial. It all depends on the new default compiler flags
introduced through src:dpkg. See: https://bugs.debian.org/1037136

We cannot fix this bug right now. Only in experimental, where we have the new
dpkg already. As soon as the dpkg time_t changes land in unstable, we need to
fix affected libraries quickly, to minimize breakage. That's why we're
currently staging 1000+ NMUs.

If you have other bugs to address you can do that in unstable. But please
revert the NMU patch for the time being. As stated above, we need to wait
for dpkg (Bug#1037136) to land in unstable, first.

The upload you have in unstable right now is still compiled using the old
time_t ABI, thus will be broken once the dpkg changes land.

We don't have t64 libraries in unstable, yet. So it is not (yet) affecting
gensio in unstable, but will be in due course. We wanted to give maintainers
a bit of headroom, before uploading NMUs into unstable en masse.

Please roll back the NMU patch in unstable. But feel free to upload other
changes that are needed to fix gensio bugs. We'll then need to rebase the NMU.

After Bug#1037136 is resolved in unstable, we can upload the changes from the
NMU patch to unstable, which will pick up the new 64-bit time_t ABI and thus
close this bug. This should happen within the next few weeks.

I understand this can be confusing, dicussion about it has been going on for
the past several weeks and months, feel free to jump into those threads for
further clarification:
- https://lwn.net/ml/debian-devel/ZGRSOnvO0dtCUbJ1@homer.dodds.net/
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1036884

Cheers,
  Lukas

#1037136#40
Date:
2024-02-07 07:53:59 UTC
From:
To:
Hi.

libmrcal-dev does not use time_t. I'm seeing the abi-compliance-checker
failure here:

https://adrien.dcln.fr/misc/armhf-time_t/2024-02-01T09%3A53%3A00/logs/libmrcal-dev/base/log.txt

The cause is that the tool takes all the headers in /usr/include/mrcal
in an arbitrary order, and tries to #include them. That does not work
here. "mrcal-internal.h" should not be #included explicitly since it is
already #included by mrcal.h. Removing that header from the command in
the error log above makes the errors disappear.

Can we do that, and remove libmrcal-dev from this transition?

Thanks.

#1037136#45
Date:
2024-02-20 17:33:17 UTC
From:
To:
Hi *,

from my experience, adding -Werror=* flags causes breakage
because way too many configure scripts miss the appropriate
headers when probing for symbols, so this wouldn’t lead to
build failures but to changed feature sets or the programs
using older/fallback APIs (e.g. if probing openat() fails,
a program could unconditionally use open in an insecure way
as fallback, and the missing header would be there in the
site that actually uses it but autoconf generally misses
them).

In MirBSD, I’ve worked around this by appending a new flag
-Werror-maybe-reset to CFLAGS and CXXFLAGS which has no
effect in GCC unless an extra environment variable is set,
in which case it does -Wno-error. Then, we set that env
during the configure call but not during make all/install.
This was achieved with a trivial local GCC patch.

I know we already add -Werror=format-security in many
cases, but that has less chance to break the configue
stage (even so I’d look sceptical at it).

bye,
//mirabilos

#1037136#50
Date:
2024-02-24 22:36:53 UTC
From:
To:
I need to upload qpdf 11.9.0-1 to unstable. Since this is newer than
11.8.0-1.1~exp1 in experimental with the 64-bit time_t NMU, it will
cause that to disappear. In an effort to avoid that and keep things in
sync with the time_t transition, I have ported the NMU forward to
11.9.0-1 and will upload 11.9.0-2~exp1 with the time_t changes to
experimental right after I upload 11.9.0-1 to experimental. I am
hoping that I am not messing anything up with this. Please feel free
to adjust tags, do a separate NMU, or whatever is needed if I have
gotten things out of sync. In any case, I want to get 11.9.0-1
uploaded right away since I'd like it to sync to Ubuntu before the
24.04 feature freeze.

I'm sending this to the qpdf NMU debdiff bug and to the bug
referenced in that issue. Thanks.

#1037136#53
Date:
2024-02-27 03:22:02 UTC
From:
To:
Hi!

Bug #1037136 in package dpkg reported by you has been fixed in
the dpkg/dpkg.git Git repository. You can see the changelog below, and
you can check the diff of the fix at:

https://git.dpkg.org/cgit/dpkg/dpkg.git/diff/?id=1f0ebe194
On Debian the plan is to switch all architectures to default to time64,
except for i386 (which is left to use time32 for backwards binary
compatibility reasons), and hurd-i386 and kfreebsd-i386 (which do not
have time64 support).

In addition, the default compiler (gcc) also emits the necessary
pre-processor flags on armel, armhf, hppa, m68k, mips, mipsel, powerpc
and sh4, so for those if the user has explicitly requested abi=-time64
we need to emit options to unset the macros.

If the user explicitly requests abi=+time64, then it will be enabled
everywhere (except for hurd-i386 and kfreebsd-i386 where the kernel does
not support it), so that it can be requested explicitly on packages that
want or need to be time64 aware regardless of the default exception, and
so that we do not break any ABI with packages that might have already
opted in.

Based-on-patch-by: Steve Langasek <steve.langasek@ubuntu.com>
Closes: #1037136

#1037136#60
Date:
2024-02-27 04:19:50 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
dpkg, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1037136@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Guillem Jover <guillem@debian.org> (supplier of updated dpkg package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Tue, 27 Feb 2024 04:28:03 +0100
Source: dpkg
Architecture: source
Version: 1.22.5
Distribution: unstable
Urgency: medium
Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
Changed-By: Guillem Jover <guillem@debian.org>
Closes: 1037136 1063641 1064036 1064856
Changes:
 dpkg (1.22.5) unstable; urgency=medium
 .
   [ Guillem Jover ]
   * dpkg-buildapi: Remove -v alias for --version.
   * dpkg-query: Fix exit codes for --show. Closes: #1064036
   * Perl modules:
     - Dpkg::OpenPGP::Backend::Sequoia: Update to new CLI API changes.
     - Dpkg::OpenPGP::Backend::GnuPG: Add support for Sequoia gpg Chameleon.
     - Dpkg::Vendor::Debian: Only append branch compiler flags if $flag is set.
     - Dpkg::Vendor: Make the add_build_flags() a non-private method.
     - Dpkg::Vendor::Ubuntu: Pass compiler flags to disable features.
       Based on a patch by Matthias Klose <doko@ubuntu.com>.
     - Dpkg::Vendor::Debian: Enable time64 feature by default except on
       <some>-i386. Closes: #1037136
       Based on a patch by Steve Langasek <steve.langasek@ubuntu.com>.
     - Dpkg::Vendor::Debian: Enable qa=+bug-implicit-func for abi=+time64
       feature. Based on a patch by Steve Langasek <steve.langasek@ubuntu.com>.
   * Documentation:
     - man, doc: Fix dpkg-buildapi option and command grouping in descriptions.
     - man: Add spaces around make variable assignments.
     - man: Do not duplicate list of known feature areas in dpkg-buildflags.
     - man: Document known feature areas in DEB_BUILD_OPTIONS for
       dpkg-buildpackage.
     - man: Improve build flags feature specification in environment variables.
       Closes: #1063641
     - man: Use L</> markup for inter link reference.
     - man: Mention Build-Depends-Packages in dpkg-shlibdeps(1).
   * Code internals:
     - libdpkg: Add comment clarifying GNU long name tar format expectations.
     - libdpkg: Use an intermediate mode variable in secure_unlink_statted().
     - dpkg: Rename symlink_len to linksize.
     - dpkg: Rename r variable for readlink() return value to linksize.
     - dpkg: Reduce variable scope in conffderef().
     - libdpkg: Refactor file_readlink() function.
     - libdpkg: Deindent an else clause.
     - lib, src: Fold if with last previous else.
     - perl: Fold if into previous else.
     - dpkg-mergechangelogs: Refactor merge_tail() sub from anonymous sub.
     - dpkg-query: Rename rc variables tracking no matches to misses.
     - dpkg-query: Rename failures variables tracking no matches to misses.
   * Build system:
     - Rename pkexec variables to polkitactions.
     - Move directory definitions to configure.
     - Use PACKAGE_TARNAME for pathname components in directories.
     - Split each automake variable value into its own line.
     - Reorder automake variables.
     - Move update-alternatives rules within automake conditional.
     - Move MD_LIBS from LDFLAGS to LDADD for libdpkg.
     - Fix libdpkg library flags for static and dynamic linking.
     - Add infrastructure for bash-completions.
   * Test suite:
     - Pass -T+1 to xz to workaround spurious warning with xz 5.6.0.
       Closes: #1064856
 .
   [ Helge Kreutzmann ]
   * Localization:
     - Update German man pages translation.
     - Update German scripts translation.
Checksums-Sha1:
 a327bd1b09be4af91b84d0d99e0e45595dda6eeb 3041 dpkg_1.22.5.dsc
 16de0df8aabef7a777671f3186c821d165e0e079 5627632 dpkg_1.22.5.tar.xz
 2a4adf938a94ceab4ddd577a38e4650b1f628bf8 8392 dpkg_1.22.5_amd64.buildinfo
Checksums-Sha256:
 da8f47d0174427502206282aae146858a999778c15f2c662990a09813239aa4e 3041 dpkg_1.22.5.dsc
 26d27610536fdf951aa2be84503166c6ca8f6c36f71c049ab562ccca3233ca7e 5627632 dpkg_1.22.5.tar.xz
 fedda0f33084e509c9c147cef44d4a39fc2a5f8fd11eb2f53e67a4a1d142e3bf 8392 dpkg_1.22.5_amd64.buildinfo
Files:
 6feada20e49aea82498284bb446c068a 3041 admin required dpkg_1.22.5.dsc
 e93542dfde9d812b7d2b1120b9f2bb8d 5627632 admin required dpkg_1.22.5.tar.xz
 ff238038bfca125fe35af84a364b9242 8392 admin required dpkg_1.22.5_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEETz509DYFDBD1aWV0uXK/PqSuV6MFAmXdW04ACgkQuXK/PqSu
V6MKBRAAvGSS8SwQGu7peESxpZIIZkASJ/h+I1vrEDzfAvtBie+bYbaNVUQBurjb
qOZ50c1S07rH267GOYwFX0HlQ0RXYwmlAtT6ZiZ+XY0GLlvszN6i1yaIY8wk8Acm
royLUf18PEXb/bGfhTQRzxedWcJPwJ67You0fjZLb0SRMirZJgPE4k3tNbGHyD/5
NDMSrzYPGHL/8QwvFpp2WC4rX/gOCaEHcdJCxyA4ddXYWjMyj1xmU4h++UCY83zH
ZGj+hVWMkC4eTvwDBFtb4FeD8TPxmzJWnI211wZNbx/C8yMEdvt7nXm7PAHaRVwb
iCT7yKsmIoSwN7jinyJKeH0MgxL5FnlCwj8f/DTVHstIYAUP02eQ+G+I5vebiSF7
9yF9agcSSHuBExdCfsEuUhg+hvNy9NOQNafoutvHd8dUQ8yepCX1pIhuZ8ITwbGj
O32wXqan+8gSUwbEmsANv9KkWxESStAiL1LwR2aWQtar7LXMQrJEpPRFObUNAHwE
KDY9e8izBgnxWNWiWVuV+sBbdhNs5a+r9Vjd4YUrZF+GZrwbFqrxMGLM+qL/liGs
n3G6VfOaloAmhFObUClrW7h3yAX/6ay7spQ69TjuOpxWb288AzFcmwdgb60BnX+L
c/rmk64o4FYbebn89xcna4oLuOGwjqUaGBAycBRME8KpfcNLTIo=
=5SMN
-----END PGP SIGNATURE-----