[PATCH] iconv: do not report error exit with transliteration [BZ #32448]

Andreas Schwab schwab@suse.de
Thu Dec 12 13:08:37 GMT 2024


On Dez 11 2024, Aurelien Jarno wrote:

> Commit 6cbf845fcdc7 ("iconv: Preserve iconv -c error exit on invalid
> inputs (bug 32046)") changed the error exit code to report an error when
> an input character has been transliterated. This looks like a bug as the
> moto in the iconv program is to report an error code in the same
> condition as the iconv() function.
>
> This happens because the STANDARD_TO_LOOP_ERR_HANDLER macro sets a
> default value for result and later updates it if the transliteration
> succeed. With the changes, setting the default value also marks the
> input as illegal.
>
> Fix that by setting up the default value of result only when the
> transliteration is not used. This works because __gconv_transliterate()
> calls __gconv_mark_illegal_input() to return an error.

Ok.

> diff --git a/iconv/loop.c b/iconv/loop.c
> index 199fb28326..f8570371b2 100644
> --- a/iconv/loop.c
> +++ b/iconv/loop.c
> @@ -141,12 +141,13 @@
>     points.  */
>  #define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \
>    {									      \
> -    result = __gconv_mark_illegal_input (step_data);			      \
> -									      \
>      if (irreversible == NULL)						      \
> -      /* This means we are in call from __gconv_transliterate.  In this	      \
> -	 case we are not doing any error recovery outself.  */		      \
> -      break;								      \
> +      {									      \
> +	/* This means we are in call from __gconv_transliterate.  In this     \
> +	   case we are not doing any error recovery outself.  */	      \

Please also fix s/outself/ourselves/.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list