Subject: Re: bug#65310: test failure on Alpine Linux: tests/sort/sort-debug-keys

From: Pádraig Brady <[email-masked]>
Date: Tue, 15 Aug 2023 16:50:31 +0100

On 15/08/2023 14:14, Bruno Haible wrote:
> Hi,
> 
> Doing "make check" of current coreutils on Alpine Linux 3.18, I see a
> test failure that I didn't see with the coreutils-9.3 release:
> 
> FAIL: tests/sort/sort-debug-keys
> 
> I'm attaching the relevant part of tests/test-suite.log.

In the log we have:

   + LC_ALL=fr_FR.UTF-8 sort --debug -k2g -k1b,1
   sort: text ordering performed using ‘fr_FR.UTF-8’ sorting rules
   sort: note numbers use ‘.’ as a decimal point in this locale

The fact that ',' isn't used as the decimal point is surprising,
and is what's causing the test to fail.
The attached adds an extra guard to the test to skip this portion
if ',' is not in fact the decimal point.

cheers,
Pádraig

From 17e6bcf448890325095cd52d4d9df1b932f27a5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
Date: Tue, 15 Aug 2023 16:44:26 +0100
Subject: [PATCH] tests: fix false failure due to locale on alpine

* tests/sort/sort-debug-keys.sh: Decimal point was seen to be '.'
on fr_FR.UTF-8 on Alpine Linux 3.18, so add an extra guard
to ensure we've a ',' as the decimal point on this locale.
Fixes https://bugs.gnu.org/65310
---
 tests/sort/sort-debug-keys.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/sort/sort-debug-keys.sh b/tests/sort/sort-debug-keys.sh
index c97c64a10..3397ef8f0 100755
--- a/tests/sort/sort-debug-keys.sh
+++ b/tests/sort/sort-debug-keys.sh
@@ -320,6 +320,8 @@ f=$LOCALE_FR_UTF8
 
 : ${LOCALE_FR_UTF8=none}
 if test "$LOCALE_FR_UTF8" != "none"; then
+ LC_NUMERIC=$f LC_MESSAGES=C sort -g --debug /dev/null 2> debug.out
+ if grep 'numbers use .*,.* as a decimal point' debug.out >/dev/null; then
   (
   echo '   1²---++3   1,234  Mi' |
     LC_ALL=C sort --debug -k2g -k1b,1
@@ -331,7 +333,9 @@ if test "$LOCALE_FR_UTF8" != "none"; then
         -k2,2n -k2,2g -k2,2h \
         -k3,3n -k3,3g -k3,3h
   ) | sed 's/^^ .*/^ no match for key/' > out
-  compare exp out || fail=1
+  compare exp out || touch locale_fail
+ fi
+ test -f locale_fail && fail=1
 fi
 
 Exit $fail
-- 
2.41.0