Originally reported to GNU grep as bug #63484, because the latest release
failed its test for Y2K38 with a diff error.

Shown not to affect 3.8, and therefore a regression for 3.9 that was
introduced through gnulib.

Carlo
>From da54519d53239d637e3670292af7b30aa6c2f8e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <care...@gmail.com>
Date: Sat, 13 May 2023 19:06:28 -0700
Subject: [PATCH] gnulib: fix Y2038 bug (again)

AC_SYS_LARGEFILE meaning has changed, need AC_SYS_YEAR2038 as well

* NEWS: mention this
* tests: add test
* bootstrap.conf: add year2038
---
 NEWS                 |  3 +++
 bootstrap.conf       |  1 +
 tests/Makefile.am    |  3 ++-
 tests/y2038-vs-32bit | 13 +++++++++++++
 4 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 tests/y2038-vs-32bit

diff --git a/NEWS b/NEWS
index f146730..a97c2ac 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ GNU diffutils NEWS                                    -*- outline -*-
 
 ** Bug fixes
 
+  cmp/diff can again work with file dates past Y2K38
+  [bug introduced in 3.9]
+
   diff -D no longer fails to output #ifndef lines.
   [bug#61193 introduced in 3.9]
 
diff --git a/bootstrap.conf b/bootstrap.conf
index aaaacdc..2b3304b 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -100,6 +100,7 @@ xmalloca
 xreadlink
 xstdopen
 xstrtoimax
+year2038
 '
 
 # Additional xgettext options to use.  Use "\\\newline" to break lines.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 624192d..79bacfb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,7 +24,8 @@ TESTS = \
   filename-quoting \
   strip-trailing-cr \
   timezone \
-  colors
+  colors \
+  y2038-vs-32bit
 
 XFAIL_TESTS = large-subopt
 
diff --git a/tests/y2038-vs-32bit b/tests/y2038-vs-32bit
new file mode 100644
index 0000000..51633c3
--- /dev/null
+++ b/tests/y2038-vs-32bit
@@ -0,0 +1,13 @@
+#!/bin/sh
+# dates after Y2K38 are safe
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+fail=0
+
+touch -t 203901010000 in || skip_ 'touch -t 2039... failed'
+
+cmp in in || fail=1
+diff in in || fail=1
+
+Exit $fail
-- 
2.39.2 (Apple Git-143)

Reply via email to