[Bug 265950] POSIX 2008 locale failures when global locale not C

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 19 Sep 2023 02:31:08 UTC

Yuri Pankov <yuripv@FreeBSD.org> changed:

           What    |Removed                     |Added
          Component|misc                        |bin
            Version|Unspecified                 |CURRENT
           Assignee|threads@FreeBSD.org         |bugs@FreeBSD.org

--- Comment #1 from Yuri Pankov <yuripv@FreeBSD.org> ---
This one is interesting and is actually an issue with isupper() (and other is*
functions) via __sbistype()->__sbmaskrune().

__sbmaskrune() looks like the following:

static __inline int
__sbmaskrune(__ct_rune_t _c, unsigned long _f)
        return (_c < 0 || _c >= __mb_sb_limit) ? 0 :
               _CurrentRuneLocale->__runetype[_c] & _f;

The culprit here is __mb_sb_limit which is NOT related to thread locale and
rather specifies the limit of the global locale.

When global locale is set to the one with UTF-8 encoding (also true for EUC and
other encodings), __mb_sb_limit goes down to 128 (from the initial 256, which
is also the limit for ISO8859-1 and other single byte locales) so we are
failing the 0xC0 test early.

This behavior seems to be introduced in base
367ed4e13d697ceb415183d8a7acddf5f707667c, long before the xlocale work was
integrated so it wasn't really an issue back then.

You are receiving this mail because:
You are the assignee for the bug.