Package: dpkg-dev Version: 1.21.22 Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu mantic patch
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. -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer https://www.debian.org/ slanga...@ubuntu.com vor...@debian.org
From 5a861d19b1610ae82bf95e6c5142a3365436fbd2 Mon Sep 17 00:00:00 2001 From: Steve Langasek <steve.langa...@ubuntu.com> Date: Fri, 2 Jun 2023 14:30:20 +0000 Subject: [PATCH 1/3] lfs and time64 are no longer "future", call them "feature" instead Recognize future= for backwards compatibility. --- scripts/Dpkg/Vendor/Debian.pm | 32 ++++++++++++++++++++++---------- scripts/t/Dpkg_BuildFlags.t | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm index 9285a61cf..f3d81bcc2 100644 --- a/scripts/Dpkg/Vendor/Debian.pm +++ b/scripts/Dpkg/Vendor/Debian.pm @@ -105,10 +105,14 @@ sub set_build_features { # Default feature states. my %use_feature = ( - future => { + feature => { lfs => 0, time64 => 0, }, + future => { + lfs => -1, + time64 => -1, + }, qa => { bug => 0, canary => 0, @@ -172,9 +176,17 @@ sub set_build_features { ($abi, $os, $cpu) = ('', '', ''); } - ## Area: future + # compatibility: map future=[+-]lfs,time64 onto 'feature' + if ((my $flag = $use_feature{future}{lfs}) != -1) { + $use_feature{feature}{lfs} = $flag; + } + if ((my $flag = $use_feature{future}{time64}) != -1) { + $use_feature{feature}{time64} = $flag; + } + + ## Area: feature - if ($use_feature{future}{time64}) { + if ($use_feature{feature}{time64}) { # On glibc, new ports default to time64, old ports currently default # to time32, so we track the latter as that is a list that is not # going to grow further, and might shrink. @@ -211,16 +223,16 @@ sub set_build_features { if ($abi_bits != 32 or not exists $time32_arch{$arch} or $libc eq 'musl') { - $use_feature{future}{time64} = 0; + $use_feature{feature}{time64} = 0; } elsif ($libc eq 'gnu') { # On glibc 64-bit time_t support requires LFS. - $use_feature{future}{lfs} = 1; + $use_feature{feature}{lfs} = 1; } } - if ($use_feature{future}{lfs}) { + if ($use_feature{feature}{lfs}) { if ($abi_bits != 32) { - $use_feature{future}{lfs} = 0; + $use_feature{feature}{lfs} = 0; } } @@ -375,14 +387,14 @@ sub _add_build_flags { $flags->append($_, $default_flags) foreach @compile_flags; $flags->append('DFLAGS', $default_d_flags); - ## Area: future + ## Area: feature - if ($flags->use_feature('future', 'lfs')) { + if ($flags->use_feature('feature', 'lfs')) { $flags->append('CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'); } - if ($flags->use_feature('future', 'time64')) { + if ($flags->use_feature('feature', 'time64')) { $flags->append('CPPFLAGS', '-D_TIME_BITS=64'); } diff --git a/scripts/t/Dpkg_BuildFlags.t b/scripts/t/Dpkg_BuildFlags.t index 850fe28b8..d64c54bfd 100644 --- a/scripts/t/Dpkg_BuildFlags.t +++ b/scripts/t/Dpkg_BuildFlags.t @@ -85,7 +85,7 @@ is($bf->get_origin('DPKGFLAGS'), 'env', 'flag has an env origin'); ok($bf->is_maintainer_modified('DPKGFLAGS'), 'prepend marked flag as maint modified'); my %known_features = ( - future => [ qw( + feature => [ qw( lfs time64 ) ], -- 2.40.1
From 02ea4e4b7b472754458a64f37f61712d55d25c91 Mon Sep 17 00:00:00 2001 From: Steve Langasek <steve.langa...@ubuntu.com> Date: Fri, 2 Jun 2023 14:54:33 +0000 Subject: [PATCH 2/3] Enable time64 by default for all 32-bit archs, except for i386 --- scripts/Dpkg/Vendor/Debian.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm index f3d81bcc2..20d77fea1 100644 --- a/scripts/Dpkg/Vendor/Debian.pm +++ b/scripts/Dpkg/Vendor/Debian.pm @@ -107,7 +107,7 @@ sub set_build_features { my %use_feature = ( feature => { lfs => 0, - time64 => 0, + time64 => 1, }, future => { lfs => -1, @@ -160,11 +160,6 @@ sub set_build_features { my $opts_build = Dpkg::BuildOptions->new(envvar => 'DEB_BUILD_OPTIONS'); my $opts_maint = Dpkg::BuildOptions->new(envvar => 'DEB_BUILD_MAINT_OPTIONS'); - foreach my $area (sort keys %use_feature) { - $opts_build->parse_features($area, $use_feature{$area}); - $opts_maint->parse_features($area, $use_feature{$area}); - } - require Dpkg::Arch; my $arch = Dpkg::Arch::get_host_arch(); @@ -176,6 +171,15 @@ sub set_build_features { ($abi, $os, $cpu) = ('', '', ''); } + if ($arch eq 'i386') { + $use_feature{feature}{time64} = 0; + } + + foreach my $area (sort keys %use_feature) { + $opts_build->parse_features($area, $use_feature{$area}); + $opts_maint->parse_features($area, $use_feature{$area}); + } + # compatibility: map future=[+-]lfs,time64 onto 'feature' if ((my $flag = $use_feature{future}{lfs}) != -1) { $use_feature{feature}{lfs} = $flag; -- 2.40.1
From 7eff8f89b32b6921a0d86c50c6c62154c6ddc96e Mon Sep 17 00:00:00 2001 From: Steve Langasek <steve.langa...@ubuntu.com> Date: Fri, 2 Jun 2023 16:30:19 +0000 Subject: [PATCH 3/3] Also emit -Werror=implicit-function-declaration for feature=+time64 Per https://lists.debian.org/debian-devel/2023/05/msg00262.html et al., missing glibc includes can cause packages to link to the wrong symbols, potentially causing crashes or misbehavior. Since functions that use time_t are fairly ubiquitous, there's a high risk of this happening for *some* package in Debian. Better to make all software with missing function declarations fail to build now, than to spend all cycle tracking down runtime bugs. --- scripts/Dpkg/Vendor/Debian.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm index 20d77fea1..803949024 100644 --- a/scripts/Dpkg/Vendor/Debian.pm +++ b/scripts/Dpkg/Vendor/Debian.pm @@ -400,6 +400,8 @@ sub _add_build_flags { if ($flags->use_feature('feature', 'time64')) { $flags->append('CPPFLAGS', '-D_TIME_BITS=64'); + $flags->append('CFLAGS', '-Werror=implicit-function-declaration'); + $flags->append('CXXFLAGS', '-Werror=implicit-function-declaration'); } ## Area: qa -- 2.40.1
signature.asc
Description: PGP signature