I did: > * m4/mbrtoc32.m4 (gl_MBRTOC32_C_LOCALE_LIKE_ISO_8859): New macro. > (gl_FUNC_MBRTOC32): Define MBRTOC32_IN_C_LOCALE_MAYBE_LIKE_ISO_8859 and > set REPLACE_MBRTOC32 on platforms such as OpenBSD. > * lib/mbrtoc32.c (mbrtoc32) [MBRTOC32_IN_C_LOCALE_MAYBE_LIKE_ISO_8859]: > In the C locale, map 0x80..0xFF differently. > * lib/btoc32.c (btoc32) [MBRTOC32_IN_C_LOCALE_MAYBE_LIKE_ISO_8859]: > Likewise. > * doc/posix-functions/mbrtoc32.texi: Mention the OpenBSD problem.
But this triggers test failures on Solaris 11 OmniOS (reported by the CI) and Solaris 11 OpenIndiana: FAIL: test-c32isprint.sh FAIL: test-mbrtoc16-1.sh FAIL: test-mbrtoc32-1.sh FAIL: test-mbsnrtoc32s-1.sh FAIL: test-mbsrtoc32s-1.sh FAIL: test-mbstoc32s-1.sh Reproducible with a testdir of mbrtoc32 mbrtoc32-regular btoc32 c32isprint This patch fixes the last 5 among these failures. The problem was that the code that was meant for OpenBSD (which has a very primitive mbrtoc32 function) happens to also trigger on these Solaris 11 derivatives (which have a more elaborate mbrtoc32 function[1]), leading to an inconsistency between btoc32() and mbrtoc32(). [1] https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/locale/mbrtoc32.c 2026-08-31 Bruno Haible <[email protected]> mbrtoc32: Don't enable the OpenBSD workaround on Solaris 11 OpenIndiana. * m4/mbrtoc32.m4 (gl_FUNC_MBRTOC32): Ignore $gl_cv_func_mbrtoc32_C_locale_like_iso_8859 on Solaris. diff --git a/m4/mbrtoc32.m4 b/m4/mbrtoc32.m4 index 2631695713..bfd933d510 100644 --- a/m4/mbrtoc32.m4 +++ b/m4/mbrtoc32.m4 @@ -1,5 +1,5 @@ # mbrtoc32.m4 -# serial 26 +# serial 27 dnl Copyright (C) 2014-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -49,9 +49,18 @@ AC_DEFUN([gl_FUNC_MBRTOC32] *yes) case "$gl_cv_func_mbrtoc32_C_locale_like_iso_8859" in *yes) - AC_DEFINE([MBRTOC32_IN_C_LOCALE_MAYBE_LIKE_ISO_8859], [1], - [Define if the mbrtoc32 function in the C locale may work like in an ISO-8859-1 locale.]) - REPLACE_MBRTOC32=1 + case "$host_os" in + solaris*) + dnl Solaris 11 OpenIndiana has a well-working mbrtoc32. No + dnl need to apply the MBRTOC32_IN_C_LOCALE_MAYBE_LIKE_ISO_8859 + dnl workaround. + ;; + *) + AC_DEFINE([MBRTOC32_IN_C_LOCALE_MAYBE_LIKE_ISO_8859], [1], + [Define if the mbrtoc32 function in the C locale may work like in an ISO-8859-1 locale.]) + REPLACE_MBRTOC32=1 + ;; + esac ;; esac ;;
