From 91927b7c76437db860cd86a7714476b56bb39d07 Mon Sep 17 00:00:00 2001 From: Arjun Shankar Date: Tue, 7 Jul 2020 20:31:48 +0200 Subject: Rewrite iconv option parsing [BZ #19519] This commit replaces string manipulation during `iconv_open' and iconv_prog option parsing with a structured, flag based conversion specification. In doing so, it alters the internal `__gconv_open' interface and accordingly adjusts its uses. This change fixes several hangs in the iconv program and therefore includes a new test to exercise iconv_prog options that originally led to these hangs. It also includes a new regression test for option handling in the iconv function. Reviewed-by: Florian Weimer Reviewed-by: Siddhesh Poyarekar Reviewed-by: Carlos O'Donell --- iconv/Makefile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'iconv/Makefile') diff --git a/iconv/Makefile b/iconv/Makefile index b8fe8c47df..30bf996d3a 100644 --- a/iconv/Makefile +++ b/iconv/Makefile @@ -26,7 +26,7 @@ headers = iconv.h gconv.h routines = iconv_open iconv iconv_close \ gconv_open gconv gconv_close gconv_db gconv_conf \ gconv_builtin gconv_simple gconv_trans gconv_cache -routines += gconv_dl +routines += gconv_dl gconv_charset vpath %.c ../locale/programs ../intl @@ -44,7 +44,7 @@ CFLAGS-linereader.c += -DNO_TRANSLITERATION CFLAGS-simple-hash.c += -I../locale tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \ - tst-iconv7 tst-iconv-mt + tst-iconv7 tst-iconv-mt tst-iconv-opt others = iconv_prog iconvconfig install-others-programs = $(inst_bindir)/iconv @@ -61,6 +61,7 @@ include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) ifeq ($(run-built-tests),yes) xtests-special += $(objpfx)test-iconvconfig.out +tests-special += $(objpfx)tst-iconv_prog.out endif # Make a copy of the file because gconv module names are constructed @@ -81,6 +82,13 @@ endif include ../Rules +ifeq ($(run-built-tests),yes) +LOCALES := en_US.UTF-8 +include ../gen-locales.mk + +$(objpfx)tst-iconv-opt.out: $(gen-locales) +endif + $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force) $(do-install-program) @@ -95,3 +103,8 @@ $(objpfx)test-iconvconfig.out: /dev/null $(objpfx)iconvconfig cmp $$tmp $(inst_gconvdir)/gconv-modules.cache; \ rm -f $$tmp) > $@; \ $(evaluate-test) + +$(objpfx)tst-iconv_prog.out: tst-iconv_prog.sh $(objpfx)iconv_prog + $(BASH) $< $(common-objdir) '$(test-wrapper-env)' \ + '$(run-program-env)' > $@; \ + $(evaluate-test) -- cgit 1.4.1