This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=ef90821fe45b99fa8c8c4279b9a74c30f59f491d

commit ef90821fe45b99fa8c8c4279b9a74c30f59f491d (HEAD -> main)
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Feb 27 04:19:59 2024 +0100

    Dpkg::Vendor::Debian: Enable qa=+bug-implicit-func for abi=+time64 feature
    
    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 and derivatives. Better to make all software
    with missing function declarations fail to build now, than to spend
    all cycle tracking down runtime bugs.
    
    Based-on-patch-by: Steve Langasek <[email protected]>
---
 man/dpkg-buildflags.pod       |  5 ++++-
 scripts/Dpkg/Vendor/Debian.pm |  4 ++++
 scripts/t/Dpkg_BuildFlags.t   | 14 +++++++++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/man/dpkg-buildflags.pod b/man/dpkg-buildflags.pod
index b661e3562..7b3123802 100644
--- a/man/dpkg-buildflags.pod
+++ b/man/dpkg-buildflags.pod
@@ -469,7 +469,10 @@ This setting (since dpkg 1.22.0; enabled by default except 
for i386,
 hurd-i386 and kfreebsd-i386 since dpkg 1.22.5) enables 64-bit time_t support
 on 32-bit architectures where their ABI does not include it by default,
 by adding B<-D_TIME_BITS=64> to B<CPPFLAGS>.
-This setting automatically enables the B<lfs> feature as it requires it.
+This setting automatically enables the B<lfs> feature from the B<abi>
+feature area,
+and the B<bug-implicit-func> feature from the B<qa> feature area
+as it requires them.
 
 If the setting is enabled explicitly then it gets enabled on all
 architectures including i386 but not hurd-i386 nor kfreebsd-i386
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 3e5f0faec..fcf5b1e2a 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -297,6 +297,10 @@ sub set_build_features {
     if ($use_feature{abi}{time64} && ! $builtin_feature{abi}{time64}) {
         # On glibc 64-bit time_t support requires LFS.
         $use_feature{abi}{lfs} = 1 if $libc eq 'gnu';
+
+        # Require -Werror=implicit-function-declaration, to avoid linking
+        # against the wrong symbol.
+        $use_feature{qa}{'bug-implicit-func'} = 1;
     }
 
     # XXX: Handle lfs alias from future abi feature area.
diff --git a/scripts/t/Dpkg_BuildFlags.t b/scripts/t/Dpkg_BuildFlags.t
index b1c6d29f4..515ed150b 100644
--- a/scripts/t/Dpkg_BuildFlags.t
+++ b/scripts/t/Dpkg_BuildFlags.t
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 88;
+use Test::More tests => 100;
 
 BEGIN {
     $ENV{DEB_BUILD_ARCH} = 'amd64';
@@ -184,6 +184,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 $ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
 $bf = Dpkg::BuildFlags->new();
@@ -191,6 +192,7 @@ test_has_flag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_flag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 $ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
 $bf = Dpkg::BuildFlags->new();
@@ -198,6 +200,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 # 32-bit system with time32 and no time64.
 $ENV{DEB_BUILD_ARCH} = 'hurd-i386';
@@ -209,6 +212,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 $ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
 $bf = Dpkg::BuildFlags->new();
@@ -216,6 +220,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 $ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
 $bf = Dpkg::BuildFlags->new();
@@ -223,6 +228,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 # 32-bit system with time32, time64 enabled by default.
 $ENV{DEB_BUILD_ARCH} = 'armhf';
@@ -234,6 +240,7 @@ test_has_flag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_flag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 $ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
 $bf = Dpkg::BuildFlags->new();
@@ -241,6 +248,7 @@ test_has_flag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_flag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 $ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
 $bf = Dpkg::BuildFlags->new();
@@ -248,6 +256,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_flag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_flag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 # 64-bit system with built-in time64.
 $ENV{DEB_BUILD_ARCH} = 'amd64';
@@ -259,6 +268,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 $ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
 $bf = Dpkg::BuildFlags->new();
@@ -266,6 +276,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 $ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
 $bf = Dpkg::BuildFlags->new();
@@ -273,5 +284,6 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
 test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
 test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
 
 # TODO: Add more test cases.

-- 
Dpkg.Org's dpkg

Reply via email to