Skip to content

mkosi: use locale that supports UTF-8, detect one that is available#8340

Merged
keszybz merged 1 commit intosystemd:masterfrom
filbranden:mkosi1
Mar 5, 2018
Merged

mkosi: use locale that supports UTF-8, detect one that is available#8340
keszybz merged 1 commit intosystemd:masterfrom
filbranden:mkosi1

Conversation

@filbranden
Copy link
Copy Markdown
Contributor

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 test step.

Tested on all of mkosi.fedora, mkosi.debian and mkosi.arch.

Fixes: #7238

/cc @johnlinp @mbiebl

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
@floppym
Copy link
Copy Markdown
Contributor

floppym commented Mar 2, 2018

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 locale -a to try and find a value that provides a UTF-8 charmap, in case the user doesn't have English locales installed.

https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/python-utils-r1.eclass#n1290

@filbranden
Copy link
Copy Markdown
Contributor Author

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...

@filbranden
Copy link
Copy Markdown
Contributor Author

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...

@johnlinp
Copy link
Copy Markdown
Contributor

johnlinp commented Mar 3, 2018

@filbranden Thanks for fixing this up.

@yuwata yuwata added the mkosi label Mar 3, 2018
@keszybz
Copy link
Copy Markdown
Member

keszybz commented Mar 5, 2018

This pains me, but let's merge until we can find a better solution.

@keszybz keszybz merged commit 2ea0966 into systemd:master Mar 5, 2018
@filbranden filbranden deleted the mkosi1 branch March 6, 2018 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

5 participants