On Sat, May 13, 2023 at 05:41:03PM +0200, Andreas Schwab wrote:
> 
> https://build.opensuse.org/package/show/home:Andreas_Schwab:Factory/grep

confirmed the diffutils (version 3.9) in that version of openSUSE, is
affected (both diff and cmp) by the Y2K38 bug[1], but grep is not.

attached v3 would workaround the diffutils bug in the test, and show that
grep is working.

Carlo

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63492
>From 635b53c17492dbf0233c9b803e5a21c82e36d7f5 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 07:28:35 -0700
Subject: [PATCH v3] tests: protect y2038-vs-32-bit against diff/cmp failures

* tests/y2038-vs-32-bit: Recreate `in` before `compare` to prevent
  the possibility of failures if the underlying tool cannot itself
  handle dates after Y2K38
---
 tests/y2038-vs-32-bit | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/y2038-vs-32-bit b/tests/y2038-vs-32-bit
index 3d3e9ae..89ab9bb 100755
--- a/tests/y2038-vs-32-bit
+++ b/tests/y2038-vs-32-bit
@@ -6,8 +6,12 @@ fail=0
 
 echo text > in || framework_failure_
 touch -t 203901010000 in || skip_ 'touch -t 2039... failed'
+
 grep t in > out 2> err || fail=1
-compare in out || fail=1
 compare /dev/null err || fail=1
 
+# Recreate to avoid triggering diffutil bugs with compare
+(rm -f in && echo text > in) || framework_failure_
+compare in out || fail=1
+
 Exit $fail
-- 
2.39.2 (Apple Git-143)

Reply via email to