[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test-sprintf-posix and test-snprintf-posix test failures
From: |
Bruno Haible |
Subject: |
Re: test-sprintf-posix and test-snprintf-posix test failures |
Date: |
Sat, 27 Apr 2024 07:51:16 +0200 |
Hi Collin,
welcome to the daily business of Gnulib test failures and workarounds!
> backtrace from test-sprintf-posix:
> ======================================
> #4 0x00000000004090cd in test_function (my_sprintf=<optimized out>) at
> /home/collin/.local/src/gnulib/testdir/gltests/test-sprintf-posix.h:3174
> retval = 5
> result = "a\000z 33\000
> 33\000cwlthcnggomhnqgbsynfxjndfoctldsdihygdqrghvtdxanjnzstbpklsewtvbncwuvbkwmfcbdjrboewqnmnqubkvhvldwqnkjjlotyfnwgsesgwmdwpjeaxutsssuwzcglqwdksajtdozlxkxkyncsiypgxpibunhbwrmieaxurpnljihggggghi"...
> buf = "12345\000EF"
> L_xyz = L"xyz"
> ======================================
>
> The reval is incorrect here:
>
> { /* NUL character. */
> int retval =
> my_sprintf (result, "a%lcz %d", (wint_t) L'\0', 33, 44, 55);
> /* ISO C had this wrong for decades. ISO C 23 now corrects it, through
> this wording:
> "If an l length modifier is present, the wint_t argument is converted
> as if by a call to the wcrtomb function with a pointer to storage of
> at least MB_CUR_MAX bytes, the wint_t argument converted to wchar_t,
> and an initial shift state." */
> ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0);
> ASSERT (retval == 6);
> }
Does the test failure persist when you disable the other tests from the
same source file (with #if 0 / #endif)?
Does the test failure persist when the tests are compiled with "-ggdb"
instead of "-g -O2"? (Change CFLAGS in gltests/Makefile.)
Does the test program use rpl_sprintf defined by Gnulib, or does it use
sprintf from glibc directly? (Use 'nm test-sprintf | grep printf'.) In
the first case, does the test failure persist when the Gnulib replacement
code is compiled with "-ggdb" instead of "-g -O2"? (Change CFLAGS in
gllib/Makefile.)
Bruno
- test-sprintf-posix and test-snprintf-posix test failures, Collin Funk, 2024/04/26
- Re: test-sprintf-posix and test-snprintf-posix test failures,
Bruno Haible <=
- Re: test-sprintf-posix and test-snprintf-posix test failures, Collin Funk, 2024/04/27
- Re: test-sprintf-posix and test-snprintf-posix test failures, Bruno Haible, 2024/04/27
- Re: test-sprintf-posix and test-snprintf-posix test failures, Collin Funk, 2024/04/28
- Re: test-sprintf-posix and test-snprintf-posix test failures, Collin Funk, 2024/04/28
- Re: test-sprintf-posix and test-snprintf-posix test failures, Bruno Haible, 2024/04/28
- Re: test-sprintf-posix and test-snprintf-posix test failures, Collin Funk, 2024/04/30