From 06ed0625bd856877f9799ed92ae48d97b5e2af11 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Thu, 11 Dec 2025 22:02:55 +0000 Subject: [PATCH] tests: fix recent portability issue with printf * 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 | 6 ++++++ tests/sort/sort-locale.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cfg.mk b/cfg.mk index e0d90cf831..393b6bbb11 100644 --- 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)' \ diff --git a/tests/sort/sort-locale.sh b/tests/sort/sort-locale.sh index b1cdbb8e4b..5339bd8301 100755 --- a/tests/sort/sort-locale.sh +++ b/tests/sort/sort-locale.sh @@ -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 -- 2.47.3