[Toybox] toybox ebuild.

Rob Landley rob at landley.net
Mon Feb 13 16:54:27 PST 2023


On 2/13/23 11:09, enh wrote:
> On Mon, Feb 13, 2023 at 1:07 AM Rob Landley <rob at landley.net> wrote:
>> >> Oh goddess why is it doing uselocale(newlocale()), I think it was a macos thing?
>> >> Yeah, git annotate says commit 4786fd610 which was Elliott. (Do you remember why
>> >> it was doing that?)
>> >
>> > because there isn't a C.UTF-8 (no matter how you try to spell it!) on
>> > macOS, so we need to "merge" utf-8-ness into the current locale. (i'd
>>
>> That isn't what  the  man page for newlocale() says we're doing, though?
>> newlocale(FLAG, "NAME", 0) is creating a new locale that's a subset of the
>> "NAME" locale, and the 0 means locale elements we don't give a flag for are
>> copied from the "POSIX" locale. (Which should be a synonym for "C".)
> 
> i don't think so? that's not how i read
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/newlocale.html
> anyway. i think it comes down to how you interpret "default locale"? i
> read it as equivalent to "", but you think it means "POSIX". i think
> POSIX agrees with me though? (search for "default locale" on
> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html
> for their definition. this is why we call setlocale() in that code,
> fwiw.)

I was going by https://man7.org/linux/man-pages/man3/newlocale.3.html

       For  each category specified in category_mask, the locale data from lo‐
       cale will be used in the object returned by newlocale().  If a new  lo‐
       cale  object is being created, data for all categories not specified in
       category_mask is taken from the default ("POSIX") locale.

It's entirely possible bionic and glibc are doing different things here. I
wonder what musl is doing? (Alas, got my eyes dilated for an eye exam today, so
not digging through code to try to find out just now...)

Rob


More information about the Toybox mailing list