Package: dpkg
Severity: wishlist
Tags: lfs, patch, hppa
Version: 1.21.17

Binaries on most (all?) 32-bit platforms will have the y2038 problem, if
they haven't been compiled with the "_TIME_BITS=64" define.

This bug report is about the request to add a dpkg option similar to
the "future=+lfs" option, and which can be added to DEB_BUILD_MAINT_OPTIONS
by package maintainers if they can and want their binaries compiled for 
y2038-readiness.

My proposal is to call this option "future=+time64", which should be disabled
by default.

Attached is a patch proposal for such a feature.

Please note:
glibc requires that _FILE_OFFSET_BITS=64 is set as well, if _TIME_BITS=64 is 
set, see:
/usr/include/features-time64.h:#   error "_TIME_BITS=64 is allowed only with 
_FILE_OFFSET_BITS=64"
Because of that, "future=+time64" implies that "future=+lfs" is set too.
The attached patch takes care of that requirement.
Setting either of "future=+time64" or "future=+lfs" has no effect on 64-bit 
platforms.

Thanks,
Helge
diff -up ./scripts/Dpkg/Vendor/Debian.pm.org ./scripts/Dpkg/Vendor/Debian.pm
--- ./scripts/Dpkg/Vendor/Debian.pm.org	2022-12-21 11:07:11.032960709 +0000
+++ ./scripts/Dpkg/Vendor/Debian.pm	2023-01-31 15:43:22.743836679 +0000
@@ -100,6 +100,7 @@ sub _add_build_flags {
     my %use_feature = (
         future => {
             lfs => 0,
+            time64 => 0,
         },
         qa => {
             bug => 0,
@@ -187,13 +188,17 @@ sub _add_build_flags {
 
     ## Area: future
 
-    if ($use_feature{future}{lfs}) {
+    if ($use_feature{future}{lfs} or $use_feature{future}{time64}) {
         my ($abi_bits, $abi_endian) = Dpkg::Arch::debarch_to_abiattrs($arch);
         my $cpu_bits = Dpkg::Arch::debarch_to_cpubits($arch);
 
         if ($abi_bits == 32 and $cpu_bits == 32) {
+            # time64 future feature implies lfs
             $flags->append('CPPFLAGS',
                            '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+            if ($use_feature{future}{time64}) {
+                $flags->append('CPPFLAGS', '-D_TIME_BITS=64');
+            }
         }
     }
 

Reply via email to