[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#537743: locales-all postinst uses too much RAM



Joachim Breitner a écrit :
> Hi,
> 
> Am Montag, den 20.07.2009, 17:56 +0200 schrieb Joachim Breitner:
>> I was under the impression that locales-all’s purpose is to be installed
>> on machines too weak to compile the locales tables themselves.
>> Nevertheless, the postinst for locales-all extracts a large armound of
>> data to /tmp (which these days, especially on mobilde devices, often is
>> a tmpfs) calls localedef.
>>
>> (I admit I can’t check which one is causing more problems, because the
>> device does not react at the moment).
>>
>> Would it be possible to have locales-all completely static? Or maybe
>> otherwise reduce the workload to be done at postinst time?
> 
> ok, it is the extracting that’s the issue here, the localedef call is
> not fast, but does not exceed any resources.
> 
> So, can’t locales-all just ship /usr/lib/locale/locale-archive
> completely?

That's an option, but it means someone has to work on patching locales
generation tools, as it is currently not possible to create
/usr/lib/locale/locale-archive during the build.

> Alternatively, the load on /tmp could be reduced considerably by
> something like this in postinst (untested pseudocode):
> 
> if [ "$1" = "configure" ]; then
> 	[ -d /usr/lib/locale ] || mkdir /usr/lib/locale
> 	#  Remove existing locales, otherwise localedef does not
> 	#  overwrite them and exits with a non-null value
> 	rm -f /usr/lib/locale/locale-archive 2>/dev/null || true
> 	tmpdir=$(mktemp -d -t locales.XXXXXXXXXX)
> 	trap 'rm -rf "$tmpdir" > /dev/null 2>&1' exit
>         for locale in list of locales filled here at compile time
>         do
> 		tar --use-compress-program /usr/bin/lzma -xf /usr/lib/locales-all/supported.tar.lzma -C "$tmpdir" ./$locale
> 		localedef --quiet --add-to-archive "$tmpdir"/$locale
> 		rm -rf "$tmpdir"/$locale
> 	done
> fi
> 

That means supported.tar.lzma will be "unlzmaed" a lot of time, eating a
lot of CPU resources.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net



Reply to: