On 26/03/2024 18:54, Bruno Haible wrote:
Pádraig Brady wrote:
The misc/numfmt test fails on
- Alpine Linux 3.18,
- macOS 12.5,
- FreeBSD 14.0,
- Solaris 11 OpenIndiana.
Find attached the test-suite.log files.
If these test failures are due to platform-specific *printf bugs, please
provide a test case for *printf at the C level. Then I can add a workaround
in Gnulib.
The failures were due to an empty thousands grouping char
in the fr_FR.UTF-8 locale on those systems. Fixed with:
https://github.com/coreutils/coreutils/commit/c0f02a8f5
The failures on Alpine Linux and macOS are gone.
However, the test failures on FreeBSD 14.0 and Solaris 11 OpenIndiana are
still present.
FreeBSD 14 at least looks to be counting bytes rather than chars
from the field width specs. The attached avoids this test portion
if there is a mismatch between printf(1) and the expected width.
cheers,
Pádraig
From 606f54d157c3d9d558bdbe41da8d108993d86aeb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Tue, 26 Mar 2024 19:17:16 +0000
Subject: [PATCH] tests: numfmt: fix false failures on some systems
* tests/misc/numfmt.pl: Verify that printf field width specs
count characters and not bytes before enabling locale tests.
This was seen on FreeBSD 14.0 and Solaris 11 OpenIndiana.
Reported by Bruno Haible
---
tests/misc/numfmt.pl | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/misc/numfmt.pl b/tests/misc/numfmt.pl
index 7abcb39ce..94f9ec58e 100755
--- a/tests/misc/numfmt.pl
+++ b/tests/misc/numfmt.pl
@@ -1070,13 +1070,15 @@ if ($locale ne 'C')
{
# Reset locale to 'C' if LOCALE_FR_UTF8 doesn't output as expected
# as determined by the separate printf program.
- open(LOC_NUM, "env LC_ALL=$locale printf \"%'d\" 1234|")
- or die "Can't fork command: $!";
+ my $printf_cmd = "env LC_ALL=$locale printf \"%'06.f\" 1234;" .
+ "env LC_ALL=$locale printf \"%'6.f\" 1234;";
+ open(LOC_NUM, "$printf_cmd|") or die "Can't fork command: $!";
my $loc_num = <LOC_NUM>;
close(LOC_NUM) || die "Failed to read grouped number from printf";
- if ($loc_num ne "1${lg}234")
+ my $loc_match = "01${lg}234 1${lg}234";
+ if ($loc_num ne $loc_match)
{
- warn "skipping locale grouping tests as 1234 groups like $loc_num\n";
+ warn "skipping locale grouping tests as $loc_num != $loc_match\n";
$locale = 'C';
}
}
--
2.44.0