mkosi: use locale that supports UTF-8, detect one that is available#8340
mkosi: use locale that supports UTF-8, detect one that is available#8340keszybz merged 1 commit intosystemd:masterfrom
Conversation
Using C.UTF-8 (as was done before systemd#7244) breaks Arch Linux, but using en_US.UTF-8 (after systemd#7244) breaks Debian in our .mkosi/mkosi.debian. So try to detect which one is available and works, first checking whether we're already running under a valid UTF-8 locale, then trying C.UTF-8 and finally en_US.UTF-8. If we fail to find a valid UTF-8 locale, then fail early, instead of letting the whole build complete only for Mesos to fail midway through the `ninja test` step. Tested on all of mkosi.fedora, mkosi.debian and mkosi.arch. Fixes: systemd#7238
|
We have the same issue on Gentoo Linux when building various python packages, and anything with meson. Our super-hackaround is to loop through the output of https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/python-utils-r1.eclass#n1290 |
|
FTR, I think C.UTF-8 is the right solution. And even there has been little movement on this bug, glibc folks seem to agree that's a good idea too. Perhaps either ping glibc folks again, or find a good way to ship C.UTF-8 in all popular distros? Seems like Debian/Ubuntu have shipped this for ages and Fedora 27 includes it too, though CentOS 7 doesn't seem to have it... |
|
Digging down a little bit... Fedora added C.UTF-8 back in 2015 using this patch and tracked on this bug. I'm not a locale expert, so not sure how easy it would be to reproduce that in other distributions (or in upstream glibc)... Something to consider... |
|
@filbranden Thanks for fixing this up. |
|
This pains me, but let's merge until we can find a better solution. |
Using C.UTF-8 (as was done before #7244) breaks Arch Linux, but using en_US.UTF-8 (after #7244) breaks Debian in our .mkosi/mkosi.debian.
So try to detect which one is available and works, first checking whether we're already running under a valid UTF-8 locale, then trying C.UTF-8 and finally en_US.UTF-8.
If we fail to find a valid UTF-8 locale, then fail early, instead of letting the whole build complete only for Mesos to fail midway through the
ninja teststep.Tested on all of mkosi.fedora, mkosi.debian and mkosi.arch.
Fixes: #7238
/cc @johnlinp @mbiebl