]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: sort: check byte-wise ordering in the C.UTF-8 locale
authorSylvestre Ledru <sylvestre@debian.org>
Sun, 26 Jul 2026 14:59:29 +0000 (16:59 +0200)
committerPádraig Brady <P@draigBrady.com>
Mon, 27 Jul 2026 12:52:51 +0000 (13:52 +0100)
* tests/sort/sort-locale.sh: C.UTF-8 has a UTF-8 codeset but the
collation rules of C, so add a case ensuring the ordering there stays
byte-wise rather than following the linguistic rules exercised for
en_US.iso8859-1 and fr_FR.UTF-8 above.

Link: https://github.com/coreutils/coreutils/pull/323
tests/sort/sort-locale.sh

index ab71ae0dce35fe992285cd3123bbaf0734e72b9f..28d680639e85dccb53ad38440b52c09f5d550df3 100755 (executable)
@@ -51,4 +51,14 @@ if test "$(locale charmap 2>/dev/null)" = UTF-8; then
                                        # the opposite of the C/byte order
 fi
 
+# C.UTF-8 has a UTF-8 codeset but the collation rules of C,
+# so ordering must stay byte-wise there.
+export LC_ALL=C.UTF-8
+if test "$(locale charmap 2>/dev/null)" = UTF-8; then
+  printf 'aaé\naaf\nAAF\n' > in || framework_failure_
+  printf 'AAF\naaf\naaé\n' > exp || framework_failure_
+  sort in > out || fail=1
+  compare exp out || fail=1
+fi
+
 Exit $fail