On 25/12/2025 02:50, Collin Funk wrote:
I pushed the attached v2 patch, which also addresses Grisha's comments.Thanks both for the review.
I see CI on Debian 11.11 fails with: LC_ALL=ms_MY date -d 2025-10-11T13:00 date: fprintftime error: No such file or directory So this new test has found a bug. Specifically, since gnulib commit 89de9ec7458 (released in coreutils 9.9), any time a strftime % directive returns the empty string, fprintftime() will return an error. This is the case with %p in the ms_MY locale on Debian 11 at least. The attached should address the issue. cheers, Padraig
From 6168f3268f82be38b8011501c6e2bb682657fa2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]> Date: Thu, 25 Dec 2025 13:42:26 +0000 Subject: [PATCH] strftime: avoid false failure with empty strings * lib/strftime.c (width_cpy): Avoid fwrite() with 0 size objects, to avoid false failure. This was seen with %p in ms_MY locale on Debian 11 at least. --- ChangeLog | 7 +++++++ lib/strftime.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 798b35677c..bdb8bff697 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-12-25 Pádraig Brady <[email protected]> + + strftime: avoid false failure with empty strings + * lib/strftime.c (width_cpy): Avoid fwrite() with 0 size objects, + to avoid false failure. This was seen with %p in ms_MY locale + on Debian 11 at least. + 2025-12-24 Paul Eggert <[email protected]> attribute: new C macro UNNAMED diff --git a/lib/strftime.c b/lib/strftime.c index 16e1cb3bc6..1ca4950f60 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -316,7 +316,7 @@ typedef sbyte_count_t retval_t; else if (to_uppcase) \ for (byte_count_t _i = 0; _i < _n; _i++) \ FPUTC (TOUPPER ((UCHAR_T) _s[_i], loc), p); \ - else if (fwrite (_s, _n, 1, p) == 0) \ + else if (n_ && fwrite (_s, _n, 1, p) == 0) \ return FAILURE; \ } \ while (0) \ -- 2.52.0
