[luatex] luatex with unexpected locale

Norbert Preining preining at logic.at
Fri Aug 18 02:22:41 CEST 2017

Hi Luigi,

> luatex exits if setlocale (LC_ALL, "") returns NULL,

Indeed, that is what has happened in our case.
It was a chroot where outside LANG was set to something (whatever)
but C, and inside the chroot the locales have not been available.
That means that setlocale fails.

Perl treats this with a warning and say: resetting to C,
I think this would be a sensible behaviour for luatex, too.

>         /* If setlocale fails here, then the state   */
>         /* could be compromised, and we exit.        */
>         env_locale = setlocale (LC_ALL, "");
>         if (!env_locale && !lua_only) {
>           fprintf(stderr,"Unable to read environment locale: exit now.\n");
>           exit(1);
>         }

What do you mean with "compromised" - it is most of the time
a simple setup error due to missing locales (not generated).
Perl does this:
	perl: warning: Setting locale failed.
	perl: warning: Please check that your locale settings:
		LANGUAGE = "en_US:en",
		LC_ALL = (unset),
		LANG = "de_CH.UTF8"
	    are supported and installed on your system.
	perl: warning: Falling back to the standard locale ("C").

Since you *anyway* switch to C, I don't see any reason to exit
there? What bad could come from it? What "compromised" status?

> The rationale behind this choice is that we want that luatex starts
> in a sane environment;
> of course we could force the locale to C, so that lc_type, lc_collate
> and  lc_numeric always store "C" (pretty useless) but   this can also

Why? You *are* doing that anyway! So what is about "pretty useles"?

> environment, and of course the user will complain saying that luatex
> has a bug because doesn't read the locale....

Where are the locales used?

Anyway, in Debian I will work around that by at least resetting LANG=C
when building the formats, to make sure that installations don't break
in chroots.

All the best


PREINING Norbert                               http://www.preining.info
Accelia Inc.     +    JAIST     +    TeX Live     +    Debian Developer
GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13

More information about the luatex mailing list