forked from pool/findutils
242 lines
10 KiB
Diff
242 lines
10 KiB
Diff
|
Upstream gnulib patches regarding the 'year2038' module.
|
||
|
|
||
|
Port the gnulib module year2038 to glibc-2.34.
|
||
|
|
||
|
Avoid the following build error regarding 64-bit time_t on i586 with glibc-2.34:
|
||
|
|
||
|
[ 166s] checking for 64-bit time_t... no
|
||
|
[ 166s] configure: error: in `/home/abuild/rpmbuild/BUILD/findutils-4.8.0':
|
||
|
[ 166s] configure: error: This package requires a 64-bit 'time_t' type, which your system appears to support. You might try configuring with 'CPPFLAGS="-m64" LDFLAGS="-m64"'. To build with a 32-bit time_t anyway (not recommended), configure with 'TIME_T_32_BIT_OK=yes'.
|
||
|
|
||
|
This patch squashes the M4 changes (no doc etc.) of the following upstream
|
||
|
gnulib commits related to the 'year2038' module:
|
||
|
|
||
|
* https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=dc09dc088848
|
||
|
* https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=7dd2562058aa
|
||
|
* https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=784f55e5c59a
|
||
|
* https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=7c6538cf0584
|
||
|
* https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=edb4fbdc9596
|
||
|
|
||
|
This patch changes m4 files in gnulib and therefore requires
|
||
|
'autoreconf -fi' to be run.
|
||
|
---
|
||
|
gl/m4/largefile.m4 | 28 ++-
|
||
|
gl/m4/year2038.m4 | 106 +++++++++++---
|
||
|
4 files changed, 440 insertions(+), 76 deletions(-)
|
||
|
|
||
|
Index: gl/m4/year2038.m4
|
||
|
===================================================================
|
||
|
--- gl/m4/year2038.m4.orig
|
||
|
+++ gl/m4/year2038.m4
|
||
|
@@ -1,11 +1,11 @@
|
||
|
-# year2038.m4 serial 3
|
||
|
+# year2038.m4 serial 7
|
||
|
dnl Copyright (C) 2017-2021 Free Software Foundation, Inc.
|
||
|
dnl This file is free software; the Free Software Foundation
|
||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||
|
dnl with or without modifications, as long as this notice is preserved.
|
||
|
|
||
|
-dnl Attempt to ensure that 'time_t' is a 64-bit type
|
||
|
-dnl and that the functions time(), stat(), etc. return 64-bit times.
|
||
|
+dnl Attempt to ensure that 'time_t' can go past the year 2038 and that
|
||
|
+dnl the functions 'time', 'stat', etc. work with post-2038 timestamps.
|
||
|
|
||
|
AC_DEFUN([gl_YEAR2038_EARLY],
|
||
|
[
|
||
|
@@ -18,13 +18,31 @@ AC_DEFUN([gl_YEAR2038_EARLY],
|
||
|
esac
|
||
|
])
|
||
|
|
||
|
-AC_DEFUN([gl_YEAR2038],
|
||
|
+# gl_YEAR2038_TEST_INCLUDES
|
||
|
+# -------------------------
|
||
|
+AC_DEFUN([gl_YEAR2038_TEST_INCLUDES],
|
||
|
+[[
|
||
|
+ #include <time.h>
|
||
|
+ /* Check that time_t can represent 2**32 - 1 correctly. */
|
||
|
+ #define LARGE_TIME_T \\
|
||
|
+ ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30)))
|
||
|
+ int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535
|
||
|
+ && LARGE_TIME_T % 65537 == 0)
|
||
|
+ ? 1 : -1];
|
||
|
+]])
|
||
|
+
|
||
|
+# gl_YEAR2038_BODY(REQUIRE-YEAR2038-SAFE)
|
||
|
+-----------------------------------------
|
||
|
+AC_DEFUN([gl_YEAR2038_BODY],
|
||
|
[
|
||
|
+ AC_ARG_ENABLE([year2038],
|
||
|
+ [ --disable-year2038 omit support for timestamps past the year 2038])
|
||
|
+ AS_IF([test "$enable_year2038" != no],
|
||
|
+ [
|
||
|
dnl On many systems, time_t is already a 64-bit type.
|
||
|
dnl On those systems where time_t is still 32-bit, it requires kernel
|
||
|
- dnl and libc support to make it 64-bit. For glibc on Linux/x86, this
|
||
|
- dnl is work in progress; see
|
||
|
- dnl <https://sourceware.org/glibc/wiki/Y2038ProofnessDesign>.
|
||
|
+ dnl and libc support to make it 64-bit. For glibc 2.34 and later on Linux,
|
||
|
+ dnl defining _TIME_BITS=64 and _FILE_OFFSET_BITS=64 is needed on x86 and ARM.
|
||
|
dnl
|
||
|
dnl On native Windows, the system include files define types __time32_t
|
||
|
dnl and __time64_t. By default, time_t is an alias of
|
||
|
@@ -34,16 +52,31 @@ AC_DEFUN([gl_YEAR2038],
|
||
|
dnl alias of __time64_t.
|
||
|
dnl And when compiling with -D_USE_32BIT_TIME_T, time_t is an alias of
|
||
|
dnl __time32_t.
|
||
|
- AC_CACHE_CHECK([for 64-bit time_t], [gl_cv_type_time_t_64],
|
||
|
+ AC_CACHE_CHECK([for time_t past the year 2038], [gl_cv_type_time_t_y2038],
|
||
|
[AC_COMPILE_IFELSE(
|
||
|
- [AC_LANG_PROGRAM(
|
||
|
- [[#include <time.h>
|
||
|
- int verify_time_t_size[sizeof (time_t) >= 8 ? 1 : -1];
|
||
|
- ]],
|
||
|
- [[]])],
|
||
|
- [gl_cv_type_time_t_64=yes], [gl_cv_type_time_t_64=no])
|
||
|
+ [AC_LANG_SOURCE([gl_YEAR2038_TEST_INCLUDES])],
|
||
|
+ [gl_cv_type_time_t_y2038=yes], [gl_cv_type_time_t_y2038=no])
|
||
|
])
|
||
|
- if test $gl_cv_type_time_t_64 = no; then
|
||
|
+ if test "$gl_cv_type_time_t_y2038" = no; then
|
||
|
+ AC_CACHE_CHECK([for 64-bit time_t with _TIME_BITS=64],
|
||
|
+ [gl_cv_type_time_t_bits_macro],
|
||
|
+ [AC_COMPILE_IFELSE(
|
||
|
+ [AC_LANG_SOURCE([[#define _TIME_BITS 64
|
||
|
+ #define _FILE_OFFSET_BITS 64
|
||
|
+ ]gl_YEAR2038_TEST_INCLUDES])],
|
||
|
+ [gl_cv_type_time_t_bits_macro=yes],
|
||
|
+ [gl_cv_type_time_t_bits_macro=no])
|
||
|
+ ])
|
||
|
+ if test "$gl_cv_type_time_t_bits_macro" = yes; then
|
||
|
+ AC_DEFINE([_TIME_BITS], [64],
|
||
|
+ [Number of bits in a timestamp, on hosts where this is settable.])
|
||
|
+ dnl AC_SYS_LARGFILE also defines this; it's OK if we do too.
|
||
|
+ AC_DEFINE([_FILE_OFFSET_BITS], [64],
|
||
|
+ [Number of bits in a file offset, on hosts where this is settable.])
|
||
|
+ gl_cv_type_time_t_y2038=yes
|
||
|
+ fi
|
||
|
+ fi
|
||
|
+ if test $gl_cv_type_time_t_y2038 = no; then
|
||
|
AC_COMPILE_IFELSE(
|
||
|
[AC_LANG_SOURCE(
|
||
|
[[#ifdef _USE_32BIT_TIME_T
|
||
|
@@ -52,19 +85,40 @@ AC_DEFUN([gl_YEAR2038],
|
||
|
error fail
|
||
|
#endif
|
||
|
]])],
|
||
|
- [AC_MSG_FAILURE([This package requires a 64-bit 'time_t' type. Remove _USE_32BIT_TIME_T from the compiler flags.])],
|
||
|
- [# If TIME_T_32_BIT_OK is "no" (the default) and not cross-compiling
|
||
|
- # and 'touch' works with a large timestamp, then evidently 64-bit time_t
|
||
|
+ [AC_MSG_FAILURE(
|
||
|
+ [The 'time_t' type stops working after January 2038.
|
||
|
+ Remove _USE_32BIT_TIME_T from the compiler flags.])],
|
||
|
+ [# If not cross-compiling and $1 says we should check,
|
||
|
+ # and 'touch' works with a large timestamp, then evidently wider time_t
|
||
|
# is desired and supported, so fail and ask the builder to fix the
|
||
|
# problem. Otherwise, just warn the builder.
|
||
|
- if test "${TIME_T_32_BIT_OK-no}" = no \
|
||
|
- && test $cross_compiling = no \
|
||
|
- && TZ=UTC0 touch -t 210602070628.16 conftest.time 2>/dev/null; then
|
||
|
- rm -f conftest.time
|
||
|
- AC_MSG_FAILURE([This package requires a 64-bit 'time_t' type, which your system appears to support. You might try configuring with 'CPPFLAGS="-m64" LDFLAGS="-m64"'. To build with a 32-bit time_t anyway (not recommended), configure with 'TIME_T_32_BIT_OK=yes'.])
|
||
|
- else
|
||
|
- AC_MSG_WARN([This package requires a 64-bit 'time_t' type if there is any way to access timestamps outside the year range 1901-2038 on your platform. Perhaps you should configure with 'CPPFLAGS="-m64" LDFLAGS="-m64"'?])
|
||
|
+ m4_ifval([$1],
|
||
|
+ [if test $cross_compiling = no \
|
||
|
+ && TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null; then
|
||
|
+ case `TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null` in
|
||
|
+ *'Feb 7 2106'* | *'Feb 7 17:10'*)
|
||
|
+ AC_MSG_FAILURE(
|
||
|
+ [The 'time_t' type stops working after January 2038,
|
||
|
+ and your system appears to support a wider 'time_t'.
|
||
|
+ Try configuring with 'CC="${CC} -m64"'.
|
||
|
+ To build with a 32-bit time_t anyway (not recommended),
|
||
|
+ configure with '--disable-year2038'.]);;
|
||
|
+ esac
|
||
|
+ rm -f conftest.time
|
||
|
+ fi])
|
||
|
+ if test "$gl_warned_about_y2038" != yes; then
|
||
|
+ AC_MSG_WARN(
|
||
|
+ [The 'time_t' type stops working after January 2038,
|
||
|
+ and this package needs a wider 'time_t' type
|
||
|
+ if there is any way to access timestamps after that.
|
||
|
+ Configure with 'CC="${CC} -m64"' perhaps?])
|
||
|
+ gl_warned_about_y2038=yes
|
||
|
fi
|
||
|
])
|
||
|
- fi
|
||
|
+ fi])
|
||
|
+])
|
||
|
+
|
||
|
+AC_DEFUN([gl_YEAR2038],
|
||
|
+[
|
||
|
+ gl_YEAR2038_BODY([require-year2038-safe])
|
||
|
])
|
||
|
Index: gl/m4/largefile.m4
|
||
|
===================================================================
|
||
|
--- gl/m4/largefile.m4.orig
|
||
|
+++ gl/m4/largefile.m4
|
||
|
@@ -22,7 +22,8 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE],
|
||
|
esac
|
||
|
])
|
||
|
|
||
|
-# The following implementation works around a problem in autoconf <= 2.69;
|
||
|
+# Work around a problem in Autoconf through at least 2.71 on glibc 2.34+
|
||
|
+# with _TIME_BITS. Also, work around a problem in autoconf <= 2.69:
|
||
|
# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
|
||
|
# or configures them incorrectly in some cases.
|
||
|
m4_version_prereq([2.70], [], [
|
||
|
@@ -40,6 +41,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUD
|
||
|
&& LARGE_OFF_T % 2147483647 == 1)
|
||
|
? 1 : -1]];[]dnl
|
||
|
])
|
||
|
+])# m4_version_prereq 2.70
|
||
|
|
||
|
|
||
|
# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
|
||
|
@@ -54,7 +56,8 @@ m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE
|
||
|
[AC_LANG_PROGRAM([$5], [$6])],
|
||
|
[$3=no; break])
|
||
|
m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
|
||
|
- [AC_LANG_PROGRAM([#define $1 $2
|
||
|
+ [AC_LANG_PROGRAM([#undef $1
|
||
|
+#define $1 $2
|
||
|
$5], [$6])],
|
||
|
[$3=$2; break])
|
||
|
$3=unknown
|
||
|
@@ -80,9 +83,8 @@ rm -rf conftest*[]dnl
|
||
|
AC_DEFUN([AC_SYS_LARGEFILE],
|
||
|
[AC_ARG_ENABLE(largefile,
|
||
|
[ --disable-largefile omit support for large files])
|
||
|
-if test "$enable_largefile" != no; then
|
||
|
-
|
||
|
- AC_CACHE_CHECK([for special C compiler options needed for large files],
|
||
|
+AS_IF([test "$enable_largefile" != no],
|
||
|
+ [AC_CACHE_CHECK([for special C compiler options needed for large files],
|
||
|
ac_cv_sys_largefile_CC,
|
||
|
[ac_cv_sys_largefile_CC=no
|
||
|
if test "$GCC" != yes; then
|
||
|
@@ -107,15 +109,15 @@ if test "$enable_largefile" != no; then
|
||
|
ac_cv_sys_file_offset_bits,
|
||
|
[Number of bits in a file offset, on hosts where this is settable.],
|
||
|
[_AC_SYS_LARGEFILE_TEST_INCLUDES])
|
||
|
- if test $ac_cv_sys_file_offset_bits = unknown; then
|
||
|
- _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
|
||
|
- ac_cv_sys_large_files,
|
||
|
- [Define for large files, on AIX-style hosts.],
|
||
|
- [_AC_SYS_LARGEFILE_TEST_INCLUDES])
|
||
|
- fi
|
||
|
-fi
|
||
|
+ AS_CASE([$ac_cv_sys_file_offset_bits],
|
||
|
+ [unknown],
|
||
|
+ [_AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1],
|
||
|
+ [ac_cv_sys_large_files],
|
||
|
+ [Define for large files, on AIX-style hosts.],
|
||
|
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])],
|
||
|
+ [64],
|
||
|
+ [gl_YEAR2038_BODY([])])])
|
||
|
])# AC_SYS_LARGEFILE
|
||
|
-])# m4_version_prereq 2.70
|
||
|
|
||
|
# Enable large files on systems where this is implemented by Gnulib, not by the
|
||
|
# system headers.
|