[PATCH v2 08/14] stdio-common: Fix error reporting in scanf input specifier tests
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Fri Aug 15 13:02:09 GMT 2025
On 05/06/25 14:59, Maciej W. Rozycki wrote:
> From: Maciej W. Rozycki <macro@redhat.com>
>
> Remove buffer contents reporting from the real variant of 'verify_input'
> where there has been an input data format error making the contents of
> data buffers irrelevant.
>
> For example given invalid float input data:
>
> %a:nan:1:3:nan(:
>
> these messages are produced:
>
> error: ./tst-scanf-format-skeleton.c:240: input buffer: `0000c07f'
> error: ./tst-scanf-format-skeleton.c:240: value buffer: `0000c07f'
> error: ./tst-scanf-format-skeleton.c:242: input line 1: input data format error
>
> with the two former lines irrelevant. Remove them from output then,
> only leaving:
>
> error: ./tst-scanf-format-skeleton.c:242: input line 1: input data format error
>
> No test case added as it's a test case issue in the first place.
> ---
> No change from v1.
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> stdio-common/tst-scanf-format-real.h | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> glibc-tst-scanf-format-all-real-verify-message-fix.diff
> Index: glibc/stdio-common/tst-scanf-format-real.h
> ===================================================================
> --- glibc.orig/stdio-common/tst-scanf-format-real.h
> +++ glibc/stdio-common/tst-scanf-format-real.h
> @@ -79,13 +79,13 @@
> initialize_value (v); \
> /* Make sure it's been committed. */ \
> __asm__ ("" : : : "memory"); \
> + \
> v = read_real (&errx); \
> if (errx < 0) \
> goto out; \
> - match = compare_real (val, v); \
> \
> -out: \
> - if (errx || !match) \
> + match = compare_real (val, v); \
> + if (!match) \
> { \
> union \
> { \
> @@ -104,6 +104,7 @@ out: \
> printf ("'\n"); \
> } \
> \
> +out: \
> *errp = errx; \
> match; \
> })
More information about the Libc-alpha
mailing list