Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 187658 - sys-libs/glibc - locale-gen doesn't generate locale-archive by default
Summary: sys-libs/glibc - locale-gen doesn't generate locale-archive by default
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://lwn.net/Articles/244148/
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-03 21:48 UTC by John Karp
Modified: 2019-05-27 15:33 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Karp 2007-08-03 21:48:54 UTC
The locale-gen script installed by sys-libs/glibc-2.5-r4 explicitly disables creating /usr/lib/locale/locale-archive.

The effect of this is that every glibc-using program, upon startup, will read a large number of locale files, some of which may not even exist. This is silly, especially for lightweight programs like 'cat' that get invoked hundreds of times by scripts. If locale-archive is present though, only that file gets read.

You can see the results for yourself with 'strace cat /dev/null'. On my system:
Without locale-archive: 104 syscalls, 31 of them 'open'
With locale-archive: 33 syscalls, 4 of them 'open'

All of those 'open' calls have a price. In the discussion at the provided URL, Arjan van de Ven (powertop/kernel developer) notes about opening nonexistant files:
"the lifespan of negative dentries is so short that you still go to disk ;("

So this is both a power-saving and performance issue.


Reproducible: Always

Steps to Reproduce:
1. run locale-gen
2. strace cat /dev/null
3.

Actual Results:  
/usr/lib/locale/locale-archive does not exist, so cat then wastes many syscalls getting locale information.

Expected Results:  
/usr/lib/locale/locale-archive should be created, and cat and any other program should use it.
Comment 1 Carlo Marcelo Arenas Belon 2007-08-05 08:08:40 UTC
the locale-gen script from debian (which was used as a source from this one) it now being maintained as part of the belocs-locales-bin package and uses a configuration file to define this behaviour
Comment 2 Daniel Thaler 2007-08-05 14:45:18 UTC
No, this behaviour cannot be changed via the configuration file, unless the manpage is wrong
Comment 3 SpanKY gentoo-dev 2007-08-06 00:52:48 UTC
the Debian stuff inspired the Gentoo version, but the locale-gen script we use isnt even close as i wrote it from scratch to be Gentoo integrated rather than just Debian dropped in

locale archives didnt really integrate well (at all) into existing system, but i guess i can just make the script warn when that happens
Comment 4 SpanKY gentoo-dev 2007-08-06 11:54:25 UTC
for example, localedef cannot be run in parallel ... and actually, nothing is stopping you from right now using an archive:
locale-gen --
Comment 5 SpanKY gentoo-dev 2007-12-29 21:35:37 UTC
ive changed locale-gen to default to generating a locale-archive, but the behavior is still controllable by the user

http://sources.gentoo.org/gentoo/src/patchsets/glibc/extra/locale/locale-gen?r1=1.23&r2=1.24