Backwards-incompatible changes were done in Gnulib yesterday:
Date Modules Changes
2025-10-31 nstrftime The return type changed from size_t to ptrdiff_t.
The return value in case of failure changed from 0
to -1.
2025-10-31 fprintftime The return value in case of failure changed from 0
to -1.
Find attached a patch to adapt coreutils to the 'nstrftime' change.
Tested with "make check" and "make syntax-check".
The fprintftime change does not need updates in coreutils. But it would be
an opportunity to strengthen the error handling (i.e. what happens if
fprintftime fails).
>From 2314c2dabd3b2e9ab88c1c738c67dfcc60e1d76f Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sat, 1 Nov 2025 10:26:04 +0100
Subject: [PATCH] ls: update after gnulib changed
* src/ls.c (align_nstrftime): Change return type to ptrdiff_t.
(print_long_format): Treat a negative return value from align_nstrftime
as failure.
---
src/ls.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/ls.c b/src/ls.c
index 447089422..5183a414e 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -4153,7 +4153,7 @@ print_current_files (void)
Note on glibc-2.7 at least, this speeds up the whole 'ls -lU'
process by around 17%, compared to letting strftime() handle the %b. */
-static size_t
+static ptrdiff_t
align_nstrftime (char *buf, size_t size, bool recent, struct tm const *tm,
timezone_t tz, int ns)
{
@@ -4186,9 +4186,9 @@ long_time_expected_width (void)
their implementations limit the offset to 167:59 and 24:00, resp. */
if (localtime_rz (localtz, &epoch, &tm))
{
- size_t len = align_nstrftime (buf, sizeof buf, false,
- &tm, localtz, 0);
- if (len != 0)
+ ptrdiff_t len = align_nstrftime (buf, sizeof buf, false,
+ &tm, localtz, 0);
+ if (len > 0)
width = mbsnwidth (buf, len, MBSWIDTH_FLAGS);
}
@@ -4293,7 +4293,7 @@ print_long_format (const struct fileinfo *f)
+ LONGEST_HUMAN_READABLE + 1 /* minor device number */
+ TIME_STAMP_LEN_MAXIMUM + 1 /* max length of time/date */
];
- size_t s;
+ ptrdiff_t s;
char *p;
struct timespec when_timespec;
struct tm when_local;
@@ -4451,6 +4451,8 @@ print_long_format (const struct fileinfo *f)
whole number of seconds. */
s = align_nstrftime (p, TIME_STAMP_LEN_MAXIMUM + 1, recent,
&when_local, localtz, when_timespec.tv_nsec);
+ if (s < 0)
+ s = 0;
}
if (s || !*p)
--
2.51.0