[systemd-devel] Setting the shell to the system locale

Lennart Poettering lennart at poettering.net
Thu Oct 15 04:23:59 PDT 2015


On Thu, 15.10.15 14:18, David Adam (zanchey at ucc.gu.uwa.edu.au) wrote:

> Hi,
> 
> I work on fish shell, which is a non-POSIX command-line shell. I'm
> trying to work out whether we should ship something in our source that 
> tries to set the locale for our users. Alternatively, it might be 
> something that needs to be left to distributions as it seems to be handled 
> very differently.
> 
> Is /etc/locale.conf appropriate for consumption by clients other than 
> systemd - such as shells? That is, is the format stable? If not, is there 
> a way of querying the default system locale if there is no `LANG` (etc.) 
> set in the environment - through `localectl` or otherwise?

Yes, the format is stable, and it's supposed to be a subset of
shell. See its man page.

> A broader question is: which process should be responsible for setting the 
> locale? Are the comments in the log message for 1640944a84 still 
> appropriate?

Well, currently we simply inherit the system locale stored in
/etc/locale.conf into everything, but whatever runs in the user
session may reset and override this at free will, and in many cases
this is done.

There's no established clear concept of where per-user locale is
configured. Many shells do that in their profile scripts, and distros
differ widely.

I figure the right place to store the locale is actually not the home
directory, but the user database. This is necessary as display
managers should be able to access the data (in order to switch locale
as soon as a user is picked), but should not have to touch the home
directory for it (which might well be prohibited to root, and might
involve triggering autofs and so on). Now, because when it comes to
user management we are still in the 1970s, and there's not sane or
established way to extend the user database like this. Hence things
are chaotic. accounts-daemon for example stores this data in a
separate database, that is not network transparent.

Yup, it's not pretty.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list