Closed frol closed 8 years ago
I'm pretty sure I was stripping out the i18n and locale stuff because it was so large (https://github.com/andyshinn/alpine-pkg-glibc/blob/master/APKBUILD#L25). So, I think the easy fix for this is to just have another sub-package (glibc-locale or glibc-i18n) that has the /usr/glibc-compat/share/i18n
bits. Does that solve this issue?
I didn't ask for i18n. POSIX and UTF-8 files take less than 1MB. However, having a package with all locales might also be a good idea, but I would still prefer to have C.UTF-8 in the basic packaging.
Isn't the i18n stuff a requirement for generating locales? Or are you suggesting to generate them and package them so they can be installed without needing to be generated?
There are a couple paths to take that I can see:
I'm wondering which might be most flexible. Which are you preferring?
Oh, I'm sorry. There is a file i18n
in i18n/locales/
folder, so I was just thinking about that file... and it is not required.
Here is the size of i18n
folder with charmaps/UTF-8.gz
and locales/POSIX
:
$ du -h ./i18n
372K i18n/charmaps
16K i18n/locales
392K i18n
392K is not so much.
I wouldn't ship pre-generated locales as all generated locales end up in /usr/glibc-compat/lib/locale/locale-archive
binary file.
Having separate packages for each locale might be too much of a hassle since on my Arch Linux system all locales take 9.7MB altogether.
However, an idea has just come into my mind, we can have all locales in a separate package, which I will install in my Dockerfile
, generate C.UTF-8
locale, and remove the package since I cannot imagine someone would re-generate locales inside a Docker container.
OK, I'll plan to create a glibc-i18n
package that can be used with localdef
to generate the locale and then be removed.
Another idea, is there a file or current way to know the locale desired (like a file?). We could make a package trigger to automatically generate the locale after install glibc-i18n
.
In Arch Linux, they use /etc/locale.conf
. However, there is no "standard" way of specifying this, and it is the "init" service responsible for setting up locale for the whole system. Thus, in case of Docker containers, I will have to set LANG
env variable as a step in Dockerfile, and also put it in /etc/environment
(just for the case when user will do su
/sudo
inside a container).
Give https://github.com/andyshinn/alpine-pkg-glibc/releases/tag/pre a try. I added some information to the README as well.
This one seems to be fixed! Great!
Your artifacts do not include any UTF-8 locale, which results in printing question marks instead of non-latin characters from applications relying on LC_* information, and this can even prevent code compilation in case of OracleJDK. There is an initiative to implement
C.UTF-8
locale. While it is not in glibc upstream, I have succeeded in building a customC.UTF-8
locale by copying a minimum required set of files from my Arch Linux:Once the files are in place, I can generate the locale:
NOTE: I had to force
localedef
, but it seems to be working fine after that anyway.Reproduction:
Using the following Dockerfile (look at the last 3 commands), the issue gets fixed:
Fixed version output: