[Pkg-xfce-devel] Bug#735265: Bug#735251: lightdm: user locale tweaks are clobbered by non-default locale

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Mon Jan 20 23:44:41 UTC 2014


Yves-Alexis Perez writes:

> On Mon, Jan 20, 2014 at 01:02:26PM +0900, Olaf Meeuwissen wrote:
>> >> At the very
>> >> beginning of the /etc/X11/Xsession script LANG=C.
>> >
>> > Well, this one is a problem, it's should not be the case (and it's not
>> > the case for me on any of my box).
>> 
>> C is the default locale on my system.
>
> Ok, I don't have a default locale here (so it means it defaults to
> POSIX).

AFAIK that's the same as C and the Open Group seems to agree[1] ;-)

 [1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html

But of course, LANG= and LANG=C are not exactly the same thing.

>> Okay, I've been looking at the source code a bit.  Turns out that
>> session_set_env() does not set any environment variables directly.  It
>> adds them to an internal list (session->priv->env).  This list is
>> written to the session in `session_real_run()`.  I didn't find any calls
>> to `session_unset_env()` for either LANG and GDM_LANG so would expect
>> both to be set in the session.
>> 
>> However, the greeter and user session inherit the system default locale
>> courtesy of PAM as per comment in src/session-child.c.  This probably
>> explains why I see LANG=C at the start of my Xsession.
>
> That might make sense, although I don't think it's the correct behavior
> in case an user actually choose a language in the selector.

You've probably seen the code and noticed that it is not just LANG that
is inherited.  A number of LC_* variables may get set as well.  Seeing
the that chooser does not account for those (quite understandably), it
seems to be the right thing to do to me considering the purpose of
/etc/default/locale.  What you *might* want to do is set LANG to the
value of GDM_LANG if and only if the user actually chose a language in
the selector.  Seeing that not selecting a language (or unselecting
whatever is selected, possibly by default) is not supported at present,
I would not do so at this point though.

>> Anyway, I now nuke GDM_LANG in ~/.xsessionrc and have not seen any
>> breakage yet.  The `locale` output is as I expect it and my input method
>> editor works as it used to.  I no longer have a ~/.dmrc (and it is not
>> recreated when you don't save your session).  I can pick any language I
>> please from the chooser without this having *any* effect on my session.
>> That is, the chooser does not interfere with my customizations which is
>> what I want.
>> 
> .dmrc has nothing to do with saving the session. And it's created (or at
> least should be) *before* the session is actually started.

Sorry, my fault.  I had a line in my Xsession setup that removed the
file.  I'd forgotten about that.  The ~/.dmrc file is created.

Hope this helps,
-- 
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom
                 http://www.fsf.org/jf?referrer=1962



More information about the Pkg-xfce-devel mailing list