Re: [PATCH] handle casing of i/I in Turkic languages

Christophe Lyon <[email protected]> Thu, 23 Apr 2026 15:44:43 +0200
Newsgroups gmane.comp.lib.newlib
Message-ID <CAKhMtSJrQAC24Ka4BHpikuX1hqcNBnu3bFxFYbWrbzhze4pumw@mail.gmail.com>
Hi!

I'm afraid this patch breaks users of towctrans().
Linaro CI reported this on February 25th on arm targets, and I didn't
notice any feedback?

To be more specific, it introduces regressions when running the GCC
libstdc++ testsuite, for instance when you reach
towupper, which then calls towctrans,
The comments at the beginning of towctrans.c (and other files) say:
----------------------------------------------
If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
-------------------------------------------------
and after this patch we call:
-    return towctrans_l (c, w, 0);
+    return towctrans_l (c, w, LC_GLOBAL_LOCALE);

Then, towctrans_l calls __jp2uc_l (c, locale)
and _jp2uc_l does
  const char * cs = l ? __locale_charset(l) : __current_locale_charset();
where 'l' is the locale (so LC_GLOBAL_LOCALE == -1) in this case,
and __locale_charset does:
#ifdef __HAVE_LOCALE_INFO__
  return __get_ctype_locale (locale)->codeset;
#else
  return locale->ctype_codeset;
#endif

so it dereferences a pointer with value -1 / 0xFFFFFFFF
leading to a crash.


Am I missing something, is this supposed to work?

Thanks,

Christophe


On Tue, Feb 3, 2026 at 1:21 PM Corinna Vinschen <[email protected]> wrote:
>
>
> [IDK if Thomas is subscribed.  CC'ing him here...]
>
> On Feb  2 23:08, Brian Inglis wrote:
> > Hi Thomas,
> >
> > Is upper casing with accents in fr-CA vs without in fr-FR handled?
> >
> > On 2026-02-02 10:05, Thomas Wolff wrote:
> > > Am 02.02.2026 um 14:45 schrieb Corinna Vinschen:
> > > > Hi Thomas,
> > > > thanks for the patch.  Just one point:
> >
> > > > This is a non-trivial patch, so it would be nice to have a non-trivial
> > > > commit message explaining what your doing and why.  To the uninformed
> > > > reader, the explicit exception for the turk language looks arbitrary.
> > > > Care to add a bit of text?
> >
> > > Quite a bit, very well, as attached.
> > --
> > Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada
> >
> > La perfection est atteinte                   Perfection is achieved
> > non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
> > mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
> >                                 -- Antoine de Saint-Exupéry
>