On OpenBSD 7.2, I see a test failure for vasnwprintf. The cause is that we use %n in the swprintf format string, and OpenBSD disabled that in 2021. We have already stopped using %n on OpenBSD in the snprintf format string in 2020, see https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00013.html . But for the WIDE_CHAR_VERSION case, we need to list OpenBSD explicitly.
2023-03-17 Bruno Haible <br...@clisp.org> vasnwprintf: Fix test failure on OpenBSD. * lib/vasnprintf.c (VASNPRINTF): Don't use the %n directive on OpenBSD. diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index f0575979ea..74a6712926 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -4995,6 +4995,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, || ((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \ && !defined __UCLIBC__) \ || (defined __APPLE__ && defined __MACH__) \ + || defined __OpenBSD__ \ || defined __ANDROID__ \ || (defined _WIN32 && ! defined __CYGWIN__)) /* We can avoid passing %n and instead rely on SNPRINTF's @@ -5024,6 +5025,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, - On macOS 10.13 or newer, the use of %n in format strings in writable memory by default crashes the program. + - On OpenBSD, since 2021-08-30, the use of %n in format + strings produces an abort (see + <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/vfprintf.c.diff?r1=1.79&r2=1.80&f=h>, + <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/vfwprintf.c.diff?r1=1.20&r2=1.21&f=h>). - On Android, starting on 2018-03-07, the use of %n in format strings produces a fatal error (see <https://android.googlesource.com/platform/bionic/+/41398d03b7e8e0dfb951660ae713e682e9fc0336>). @@ -5032,7 +5037,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, crashes the program. See <https://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-printf-count-output> - On the first three of these platforms, if !WIDE_CHAR_VERSION, + On the first four of these platforms, if !WIDE_CHAR_VERSION, it is not a big deal to avoid %n, because on these platforms, HAVE_SNPRINTF_RETVAL_C99 and HAVE_SNPRINTF_TRUNCATION_C99 are 1.