mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-08 23:58:31 +08:00
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 “ 1⁄2 ” 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 commit9a4b0eaf72("iconv: do not report error exit with transliteration [BZ #32448]"), commit6cbf845fcd("iconv: Preserve iconv -c error exit on invalid inputs (bug 32046)"), and bug 34236. Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
+2
-1
@@ -139,7 +139,8 @@ $(objpfx)test-iconvconfig.out: $(objpfx)iconvconfig
|
||||
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)' '$(rpath-link)' > $@; \
|
||||
$(evaluate-test)
|
||||
|
||||
+4
-2
@@ -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; \
|
||||
} \
|
||||
\
|
||||
|
||||
+13
-3
@@ -29,10 +29,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 $library_path:$LIBPATH --inhibit-rpath ${from}.so
|
||||
$codir/iconv/iconv_prog
|
||||
'
|
||||
ICONV="$test_wrapper_env $run_program_env $ICONV"
|
||||
|
||||
TIMEOUTFACTOR=${TIMEOUTFACTOR:-1}
|
||||
|
||||
@@ -220,6 +220,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
|
||||
@@ -280,7 +281,9 @@ check_errtest_result ()
|
||||
fi
|
||||
}
|
||||
|
||||
for testcommand in "${testarray[@]}"; do
|
||||
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)"
|
||||
@@ -288,4 +291,11 @@ for testcommand in "${testarray[@]}"; do
|
||||
eret="$(echo "$testcommand" | cut -d";" -f 5)"
|
||||
execute_test
|
||||
check_errtest_result
|
||||
done
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user