[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
test-sprintf-posix and test-snprintf-posix test failures
From: |
Collin Funk |
Subject: |
test-sprintf-posix and test-snprintf-posix test failures |
Date: |
Fri, 26 Apr 2024 18:20:21 -0700 |
User-agent: |
Mozilla Thunderbird |
I see two similar test failures for test-sprintf-posix and
test-sprintf-posix on Fedora 40, gcc 14, glibc 2.39.
Using:
$ ./gnulib-tool --create-testdir --dir testdir sprintf-posix snprintf-posix
$ cd testdir
$ ./configure
$ make check
The following tests fail:
./../build-aux/test-driver: line 112: 128650 Aborted (core
dumped) "$@" >> "$log_file" 2>&1
FAIL: test-snprintf-posix
PASS: test-snprintf
./../build-aux/test-driver: line 112: 128669 Aborted (core
dumped) "$@" >> "$log_file" 2>&1
FAIL: test-sprintf-posix
backtrace from test-snprintf-posix:
======================================
#4 0x00000000004097a2 in test_function (my_snprintf=<optimized out>) at
/home/collin/.local/src/gnulib/testdir/gltests/test-snprintf-posix.h:3196
retval = 5
buf = "12345\000EF"
size = <optimized out>
result = "a\000z 33\000
33\000cwlthcnggomhnqgbsynfxjndfoctldsdihygdqrghvtdxanjnzstbpklsewtvbncwuvbkwmfcbdjrboewqnmnqubkvhvldwqnkjjlotyfnwgsesgwmdwpjeaxutsssuwzcglqwdksajtdozlxkxkyncsiypgxpibunhbwrmieaxurpnljihggggghi"...
L_xyz = L"xyz"
======================================
The retval is incorrect here:
{ /* NUL character. */
int retval =
my_snprintf (result, sizeof (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);
}
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);
}
Just incase locale matters:
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Collin
- test-sprintf-posix and test-snprintf-posix test failures,
Collin Funk <=
- 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/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