Subject: bug#44763: Error when 'make'ing latest version of coreutils

From: Paul Eggert <[email-masked]>
Date: Sat, 21 Nov 2020 19:16:54 -0800

On 11/21/20 6:37 AM, Chris Elvidge wrote:
> parse-datetime.y: In function 'parse_datetime2':
> parse-datetime.y:2301:27: error: format '%lld' expects argument of type 'long 
> long int', but argument 2 has type 'time_t {aka long int}' [-Werror=format=]

That's due to a typo that I recently introduced to parse-datetime.y. Thanks for 
reporting it. (I didn't observe the problem since I tested on hosts with 64-bit 
time_t, not 32-bit.) I installed the attached patch into Gnulib and propagated 
this into Coreutils.
>From fdf0468198631a456406edc09983972edb8fa5c4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sat, 21 Nov 2020 19:04:10 -0800
Subject: [PATCH] parse-datetime: fix printf format typo

* lib/parse-datetime.y (parse_datetime2): Fix format typo in
previous patch to this file.  Problem reported by Chris Elvidge in
<https://bugs.gnu.org/44763#32>.
---
 ChangeLog            | 5 +++++
 lib/parse-datetime.y | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index de92d102e..229945e86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2020-11-21  Paul Eggert  <[email-masked]>
 
+	parse-datetime: fix printf format typo
+	* lib/parse-datetime.y (parse_datetime2): Fix format typo in
+	previous patch to this file.  Problem reported by Chris Elvidge in
+	<https://bugs.gnu.org/44763#32>.
+
 	setlocale-null-tests: work around GCC bug 44511
 	* tests/test-setlocale_null-mt-all.c:
 	* tests/test-setlocale_null-mt-one.c:
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 44ae90350..e8ed691c8 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -2298,7 +2298,8 @@ parse_datetime2 (struct timespec *result, char const *p,
                           "%+"PRIdMAX" seconds, %+d ns),\n"),
                         pc.rel.hour, pc.rel.minutes, pc.rel.seconds,
                         pc.rel.ns);
-            dbg_printf (_("    new time = %"PRIdMAX" epoch-seconds\n"), t4);
+            intmax_t t4i = t4;
+            dbg_printf (_("    new time = %"PRIdMAX" epoch-seconds\n"), t4i);
 
             /* Warn about crossing DST due to time adjustment.
                Example: https://bugs.gnu.org/8357
-- 
2.27.0