tests: printf: ensure %q quotes C1 controls in names with apostrophes

Reported at https://github.com/uutils/coreutils/issues/15810

* tests/printf/printf-quote.sh: Add a test case.

Link: https://github.com/coreutils/coreutils/pull/445
This commit is contained in:
Sylvestre Ledru authored and Pádraig Brady committed 2026-11-07 12:35:10 +00:00
1 parent d7e639418a
commit 0201866781
1 file changed
+3
+3
View File
@@ -44,12 +44,15 @@ if test -n "$LOCALE_FR_UTF8" && test "$LOCALE_FR_UTF8" != "none"; then
LC_ALL=$f $prog '%q\n' 'áḃç' > out
#non-printable multi-byte
LC_ALL=$f $prog '%q\n' "$($prog '\xc2\x81')" >> out
#non-printable multi-byte in a name with an apostrophe
LC_ALL=$f $prog '%q\n' "$($prog "it's\\xc2\\x9bhere")" >> out
#printable multi-byte in C locale
LC_ALL=C $prog '%q\n' 'áḃç' >> out
)
cat <<\EOF > exp || framework_failure_
áḃç
''$'\302\201'
'it'\''s'$'\302\233''here'
''$'\303\241\341\270\203\303\247'
EOF
compare exp out || fail=1