Subject: ignore-case test fails on several platforms

From: Bruno Haible <[email-masked]>
Date: Tue, 11 Jun 2024 23:10:23 +0200

In current diffutils (git master), I see a failure
  FAIL: ignore-case
on
  - CentOS 7,
  - macOS 11..14,
  - Solaris 11.4 and Solaris 11 OmniOS,
  - NetBSD 10.0.

How to reproduce:

$ echo 'AĀȀΆΑАӐḀἈⒶꞺＡ𐐀-Δ' >a
$ echo 'aāȁάαаӑḁἀⓐꞻａ𐐨-δ' >b
$ LC_ALL=en_US.UTF-8 ../src/diff -i a b
1c1
< AĀȀΆΑАӐḀἈⒶꞺＡ𐐀-Δ
---
> aāȁάαаӑḁἀⓐꞻａ𐐨-δ

On CentOS 7, when I set a breakpoint at 'hash', I see the following
char32_t values appear in order:
97 257 513 940 945 1072 1233 7681 7936 9424 42938 65345 66600 45 948
97 257 513 940 945 1072 1233 7681 7936 9424 42939 65345 66600 45 948
So, the c32tolower invocation that does not behave as expected is
the 11th character. Removing the 11th character fixes the test failure on
  - CentOS 7,
  - macOS 12,
  - Solaris 11 OmniOS.

The same procedure on Solaris 11.4 produces the following char32_t values:
97 257 513 940 945 1072 1233 7681 7936 9398 42938 65345 66600 45 948
97 257 513 940 945 1072 1233 7681 7936 9424 42939 65345 66600 45 948
So, here it's the 10th character that causes the comparison to fail.

The same procedure on NetBSD 11.0 produces the following char32_t values:
97 257 513 940 945 1072 1233 7681 7936 9398 42939 65345 66600 45 948
97 257 513 940 945 1072 1233 7681 7936 9424 42939 65345 66600 45 948
So, here it's the 10th character as well that causes the comparison to fail.

In summary, the attached patch fixes the test failure on all platforms.
It acknowledges that there is some variation between platforms, when it
comes to upper-/lowercase mappings.

Bruno

From 49c5fd8ac146f52a89d1b1c8fd9ee59614346499 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email-masked]>
Date: Tue, 11 Jun 2024 23:09:02 +0200
Subject: [PATCH] tests: Fix ignore-case failure on several platforms
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* tests/ignore-case: Don't compare 'Ⓐ' with 'ⓐ'; this doesn't work on
NetBSD 10.0 and Solaris 11.4. Don't compare 'Ꞻ' with 'ꞻ'; this doesn't
work on CentOS 7, macOS, and Solaris 11 OmniOS.
---
 tests/ignore-case | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ignore-case b/tests/ignore-case
index 007cce3..a65750b 100755
--- a/tests/ignore-case
+++ b/tests/ignore-case
@@ -13,8 +13,8 @@ compare /dev/null out || fail=1
 
 require_utf8_locale_
 
-echo 'AĀȀΆΑАӐḀἈⒶꞺＡ𐐀-Δ' >a
-echo 'aāȁάαаӑḁἀⓐꞻａ𐐨-δ' >b
+echo 'AĀȀΆΑАӐḀἈＡ𐐀-Δ' >a
+echo 'aāȁάαаӑḁἀａ𐐨-δ' >b
 
 diff -i a b >out || fail=1
 compare /dev/null out || fail=1
-- 
2.34.1