]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix recent portability issue with printf
authorPádraig Brady <P@draigBrady.com>
Thu, 11 Dec 2025 22:02:55 +0000 (22:02 +0000)
committerPádraig Brady <P@draigBrady.com>
Thu, 11 Dec 2025 22:02:55 +0000 (22:02 +0000)
* tests/sort/sort-locale.sh: Avoid non portable printf \u....
* cfg.mk (sc_env_printf): Add a new syntax check to flag future cases.

cfg.mk
tests/sort/sort-locale.sh

diff --git a/cfg.mk b/cfg.mk
index e0d90cf831b2ad4ddd64411a6b02c96456c4144b..393b6bbb1161a04e8d3c57791dd5165c85b54143 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -642,6 +642,12 @@ sc_env_test_dependencies:
                || echo $$test should call: print_ver_ $$prog; \
            done | grep . && exit 1 || :
 
+# Enforce using our printf if using \u or \x
+sc_env_printf:
+       @cd $(top_srcdir) && GIT_PAGER= git grep 'printf.*[^\\]\\[ux]' tests \
+         | grep -v -- '--printf' | grep -v 'env printf' \
+         && { echo 'use "env printf" with \x or \u'; exit 1; } || :
+
 # Use framework_failure_, not the old name without the trailing underscore.
 sc_prohibit_framework_failure:
        @prohibit='$(begword)framework_''failure$(endword)'             \
index b1cdbb8e4bd7402976b770b8c15c5f87460a94dd..5339bd83015184e0a4b4e8de4dbe9f38b2ce44a4 100755 (executable)
@@ -45,7 +45,7 @@ fi
 export LC_ALL=$LOCALE_FR_UTF8
 if test "$(locale charmap 2>/dev/null)" = UTF-8; then
   check_hard_collate 'aaé' 'aaf'  # é comes before f
-  check_hard_collate 'aéY' "$(printf 'ae\u0301Z')"  # NFC/NFD é are equal
+  check_hard_collate 'aéY' "$(printf 'ae\314\201Z')"  # NFC/NFD é are equal
 fi
 
 Exit $fail