glibc/glibc-RHEL-182978.patch
2026-07-22 16:48:31 +00:00

118 lines
4.3 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

commit e9325bd7d04aacc45cf39505e279b1ca9de22c08
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Jun 9 07:28:02 2026 +0200
iconv: Suppress intermediate errors with //TRANSLIT (bug 34236)
When tentatively converting characters on behalf of
__gconv_transliterate, do not create a persistent error. Just
produce a local error, and rely on __gconv_transliterate to
produce the error if all transliteration options are exhausted.
This fixes transliteration of “½” to ASCII, which cannot use the
“ 12 ” alternative. Eventually, the “ 1/2 ” alternative is chosen,
but the error sticks. Therefore, iconv exited with status 1 before
this change.
Adjust iconv/tst-iconv_prog.sh to test both C and en_US.UTF-8 locales.
This requires changing the way the ICONV template is defined, so that
run_program_env is evaluated multiple times.
Fixes commit 9a4b0eaf726f5404c6683d5c7c5e86f61c3f3fbc ("iconv: do not
report error exit with transliteration [BZ #32448]"),
commit 6cbf845fcdc76131d0e674cee454fe738b69c69d ("iconv: Preserve
iconv -c error exit on invalid inputs (bug 32046)"), and bug 34236.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Conflicts:
iconv/Makefile
(adjust for slight context differences)
iconv/tst-iconv_prog.sh
(adjust for slight context differences)
diff -Nrup a/iconv/Makefile b/iconv/Makefile
--- a/iconv/Makefile 2026-07-08 10:40:23.537996825 -0400
+++ b/iconv/Makefile 2026-07-08 11:03:32.630032185 -0400
@@ -138,7 +138,8 @@ $(objpfx)test-iconvconfig.out: $(objpfx)
rm -f $$tmp) > $@; \
$(evaluate-test)
-$(objpfx)tst-iconv_prog.out: tst-iconv_prog.sh $(objpfx)iconv_prog
+$(objpfx)tst-iconv_prog.out: tst-iconv_prog.sh $(objpfx)iconv_prog \
+ $(gen-locales)
$(BASH) $< $(common-objdir) '$(test-wrapper-env)' \
'$(run-program-env)' > $@; \
$(evaluate-test)
diff --git a/iconv/loop.c b/iconv/loop.c
index 27dea1f5d6..81841d0d2d 100644
--- a/iconv/loop.c
+++ b/iconv/loop.c
@@ -144,8 +144,10 @@
if (irreversible == NULL) \
{ \
/* This means we are in call from __gconv_transliterate. In this \
- case we are not doing any error recovery ourselves. */ \
- result = __gconv_mark_illegal_input (step_data); \
+ case we are not doing any error recovery ourselves. Do not create \
+ a persistent error state. If __gconv_transliterate exhausts all \
+ alternatives, it will call __gconv_mark_illegal_input itself. */ \
+ result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
\
diff -Nrup a/iconv/tst-iconv_prog.sh b/iconv/tst-iconv_prog.sh
--- a/iconv/tst-iconv_prog.sh 2026-07-08 10:40:23.551056344 -0400
+++ b/iconv/tst-iconv_prog.sh 2026-07-08 13:20:44.052638867 -0400
@@ -27,10 +27,10 @@ LIBPATH=$codir:$codir/iconvdata
# How the start the iconv(1) program. $from is not defined/expanded yet.
ICONV='
+$test_wrapper_env $run_program_env
$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so
$codir/iconv/iconv_prog
'
-ICONV="$test_wrapper_env $run_program_env $ICONV"
TIMEOUTFACTOR=${TIMEOUTFACTOR:-1}
@@ -218,6 +218,7 @@ testarray=(
"\x00\x00;;INVALID;UTF-8;1"
"\x00\x00;;UTF-8;INVALID;1"
"\xc3\xa9;;UTF-8;ASCII//TRANSLIT;0"
+"X\xc2\xbdY;;UTF-8;ASCII//TRANSLIT;0"
)
# Requires $twobyte input, $c flag, $from, and $to to be set; sets $ret
@@ -278,12 +279,21 @@ check_errtest_result ()
fi
}
-for testcommand in "${testarray[@]}"; do
- twobyte="$(echo "$testcommand" | cut -d";" -f 1)"
- c="$(echo "$testcommand" | cut -d";" -f 2)"
- from="$(echo "$testcommand" | cut -d";" -f 3)"
- to="$(echo "$testcommand" | cut -d";" -f 4)"
- eret="$(echo "$testcommand" | cut -d";" -f 5)"
- execute_test
- check_errtest_result
-done
+run_test_array ()
+{
+ for testcommand in "${testarray[@]}"; do
+ twobyte="$(echo "$testcommand" | cut -d";" -f 1)"
+ c="$(echo "$testcommand" | cut -d";" -f 2)"
+ from="$(echo "$testcommand" | cut -d";" -f 3)"
+ to="$(echo "$testcommand" | cut -d";" -f 4)"
+ eret="$(echo "$testcommand" | cut -d";" -f 5)"
+ execute_test
+ check_errtest_result
+ done
+}
+
+echo "info: testing C locale"
+run_test_array
+echo "info: testing en_US.UTF-8 locale"
+run_program_env="$run_program_env LC_ALL=en_US.UTF-8"
+run_test_array