Re: How to make results of “localedef” survive “dpkg-reconfigure locales”?
Tom H
tomh0665 at gmail.com
Mon Feb 25 19:11:14 UTC 2019
On Mon, Feb 25, 2019 at 5:40 PM Thorsten Schöning <tschoening at am-soft.de> wrote:
> am Montag, 25. Februar 2019 um 16:43 schrieben Sie:
>> localedef --no-archive -f CP1252 -i /usr/share/i18n/locales/de_DE
>> /usr/lib/locale/de_DE.CP1252
>
> Doesn't change a thing: Because "output" already has been a path
> before, "localedef" behaved like "--no-archive" has been provided as
> well already. A directory is created with the generated locale-files
> and nothing is added to the archive. So additionally adding
> "--no-archive" doesn't make any difference in my case.
Strange.
1) I've used the equivalent of "localedef --no-archive -f CP1252 -i
/usr/share/i18n/locales/de_DE de_DE.CP1252" and hadn't noticed that
you were using a path (and I didn't now that it made a difference!).
2) I wouldn't have expected "locale-gen" to remove anything other than
"/usr/lib/locale/locale-archive" but it does.
It turns out that "locale-gen" is a shell script and it has
if [ -z "$1" ] && [ -z "$KEEP" ]; then
# Remove all old locale dir and locale-archive before generating new
# locale data.
rm -rf /usr/lib/locale/locale-archive || true
for dir in /usr/lib/locale/*; do
[ -e "$dir" ] || continue
if [ "${dir#/usr/lib/locale/}" = C.UTF-8 ]; then
# owned by libc-bin
continue
fi
rm -rf "$dir" 2>/dev/null || true
done
fi
> If I neither provide an output path nor "--no-archive", the generated
> locale is added to the archive as documented and Postgres fails as
> well. Pretty much the same behaviour like with using "dpkg-reconfigure
> locales" only, as if the locale simply was not (properly) available
> (somewhere).
>
> There's one difference, though: "dpkg-reconfigure locales" doesn't
> recognize that the locale added to the archive using "localedef" has
> been added at all. While "localedef --list-archive" does list it as
> available, much like it lists all others added by "dpkg-reconfigure
> locales" only.
>
> That again fits exactly to my described behavior that,
> dpkg-reconfigure deletes my locale-files in a folder simply because it
> doesn't know about them for some reason.
>
> The only thing allowing me to get Postgres to succeed instantly
> currently is using "localedef" with an output path.
I added "de_DE.CP1252 CP1251" to "/etc/locale.gen".
"de_DE.CP1252" is generated by "locale-gen" and "dpkg-reconfigure locales".
More information about the ubuntu-users
mailing list