From: Pádraig Brady
Date: Tue, 26 Mar 2024 19:17:16 +0000 (+0000)
Subject: tests: numfmt: fix false failures on some systems
X-Git-Tag: v9.5~3
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=606f54d157c3d9d558bdbe41da8d108993d86aeb;p=thirdparty%2Fcoreutils.git
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
---
diff --git a/tests/misc/numfmt.pl b/tests/misc/numfmt.pl
index 7abcb39ce0..94f9ec58e7 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 =