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

Colin Guthrie colin at mageia.org
Thu Oct 15 03:06:54 PDT 2015


Hi,

David Adam wrote on 15/10/15 07:18:
> 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?
> 
> A broader question is: which process should be responsible for setting the 
> locale? Are the comments in the log message for 1640944a84 still 
> appropriate?
> 
>> Eventually we probably want to drop this again since the system locale
>> should be read and set at one place, and not at multiple, and that one 
>> place should be PID 1.
> 
> I am not sure there is a good answer to this question, but I would be 
> interested in hearing about the rationale for the different approaches. 
> For example, Debian sets up PAM to source /etc/default/locale for all 
> sessions, while Fedora drops a script in /etc/profile.d for command-line 
> shells. Most graphical shells seem to use their own defaults.

I think, if you can, you should ask localed via dbus for the locale
information (rather than parsing /etc/locale.conf directly). This way
the details of how it's set can be changed and you just use that API
directly.

I think a while back, David Herrmann hinted towards localed in the user
session (i.e. there would be a system instance for system-wide locale
and a per-user one for user preferences. Not sure if this ended up
happening or not tho'. It may be worth looking at the console stuff in
systemd to see how it sets locales?

Not much info from me but hopefully helps a bit!

Col




-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list