Grisha Levit <[email protected]> writes:

> I think this behavior might just be a gnulib bug?
>
> AFAICT, what happens in this case (no relevant variables in the
> environment, System Preferences Language/Region set such that they do
> not match a valid locale):
>
> libintl_setlocale(LC_ALL,"") will set the LC_NUMERIC category (and others) by:
> * checking the value of the "AppleLocale" preference value (en_DE)
> * calling the system setlocale with this value (which fails)
> * finding an appropriate locale name based on the territory (de_DE)
> * calling the system setlocale with this value
>
> libintil_setlocale(LC_NUMERIC, "") uses a different code path, which
> does not do the last two steps, and so will just fail.

Does bash use Gnulib's setlocale on MacOS? It doesn't have the
setlocale.m4 file which would be used by Gnulib:

    $ find . -name 'setlocale.m4' | wc -l
    0

And nothing ever sets REPLACE_SETLOCALE to 1:

    $ git grep -F 'REPLACE_SETLOCALE'
    configure:REPLACE_SETLOCALE
    configure:  REPLACE_SETLOCALE=0;
    m4/locale_h.m4:  REPLACE_SETLOCALE=0;    AC_SUBST([REPLACE_SETLOCALE])

It looks like the version in lib/intl/setlocale.c is a old 2019 version
from Gnulib that is for systems without the function.

Collin

Reply via email to