bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wctrans, towctrans: Add tests


From: Bruno Haible
Subject: Re: wctrans, towctrans: Add tests
Date: Wed, 26 Jul 2023 16:41:09 +0200

I wrote:
> I'm adding unit tests and let you guess how many bugs they will find...

Surprise! No test failure on native Windows. Neither the Microsoft guys
nor the mingw guys succeeded in botching this facility.

But the NetBSD guys did.

First, their wctrans() functions doesn't accept the strings "tolower" and
"toupper" (standardized by POSIX:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/wctrans.html ).
They want "towlower" and "towupper". And when you actually pass one of
these,  towctrans (L'a', wctrans ("towlower"))  crashes.

This patch adds a workaround.


2023-07-26  Bruno Haible  <bruno@clisp.org>

        wctrans: Work around bug on NetBSD.
        * lib/wctype.in.h (rpl_wctrans_t, wctrans_t, GNULIB_defined_wctrans_t):
        Define if REPLACE_WCTRANS is 1.
        (wctrans): Consider REPLACE_WCTRANS.
        (towctrans): Override if REPLACE_WCTRANS is 1.
        * m4/wctype_h.m4 (gl_WCTYPE_H_DEFAULTS): Initialize REPLACE_WCTRANS.
        * m4/wctrans.m4 (gl_FUNC_WCTRANS): Define through AC_DEFUN_ONCE. Test
        whether wctrans supports the "tolower" character mapping. Set
        REPLACE_WCTRANS if not.
        * m4/towctrans.m4 (gl_FUNC_TOWCTRANS): Require gl_FUNC_WCTRANS.
        * modules/wctrans (Depends-on): Add towctrans.
        (configure.ac): Consider REPLACE_WCTRANS.
        * modules/towctrans (Files): Add m4/wctrans.m4.
        (configure.ac): Override also if REPLACE_WCTRANS is 1.
        * modules/wctype-h (Makefile.am): Substitute REPLACE_WCTRANS.
        * doc/posix-functions/wctrans.texi: Mention the NetBSD bug.

Attachment: 0001-wctrans-Work-around-bug-on-NetBSD.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]