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

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Wed Jan 15 04:07:22 UTC 2014


Yves-Alexis Perez writes:

> Note: I'm replying to both bugs at once because they look quite the
> same. I'm not merging them right now because that's not completely sure
> either.
>
> On Tue, Jan 14, 2014 at 12:40:01PM +0900, Olaf Meeuwissen wrote:
>> Package: lightdm
>> Version: 1.8.5-3
>> Severity: normal
>> 
>> Dear Maintainer,
>> 
>> I have seen #690899, #691446 and #733261 but feel that my issue is not
>> quite the same.  Hence a separate bug report.
>> 
>> I have a few locale tweaks in my ~/.xsessionrc (following comments found
>> in /etc/X11/Xsession.d/40x11-common_xsessionrc).  The relevant bit of my
>> customizations:
>> 
>>   export LANG=ja_JP.UTF-8
>>   export LC_MESSAGES=en_GB.UTF-8
>>   export LANGUAGE=${LC_MESSAGES}
>> 
>> This has been working great for me for several years.  After the recent
>> upgrade of lightdm (from 1.6.3-1) the LANG setting got clobbered to the
>> first enabled locale, i.c. aa_DJ.UTF-8, whereas the system default is C.
>> 
>> The system default locale and enabled locales have not been changed in
>> a long time, nor has my .xsessionrc.  What might have played a role
>> was me removing my ~/.dmrc at about the same point as the upgrade as
>> part of a dot-file cleanup.  Changing its Language setting to the same
>> value as the LANG setting in my ~/.xsessionrc fixed things for me.
>> 
>> I would expect the preselected locale for lightdm's locale selector to
>> be the system default (or whatever is configured explicitly for that bit
>> of lightdm functionality), not whichever of the enabled locales is
>> listed first in /etc/locale.gen. 
>
> Yeah, that's not really optimal indeed. Actually that's the case only
> for the first startup after boot, and before an user is selected.

And that user has a ~/.dmrc with a language setting in it.  If the user
has no ~/.dmrc, then the first available locale is the default.
Actually, if you enter a user name, move to the password field and then
enter a *different* user's name (one who has no ~/.dmrc), that user will
end up with the previous user's locale preference.

>> The system default would then become
>> the user's locale if a user does not have a ~/.dmrc file.  Also, I would
>> expect any tweaks in a user's ~/.xsessionrc to take effect/precedence
>> and not be clobbered by any locale functionality courtesy of lightdm.
>> 
>> That is to say, I would expect my LANG setting in ~/.xsessionrc to take
>> precedence over whatever is (or ends up) in ~/.dmrc.  If I have nothing
>> in my ~/.xsessionrc, I expect to end up with what is configured in
>> /etc/default/locale.
>
> Well that should be the case, actually.

It is not.  I created a new user account on my system and restarted
lightdm.  I gave that user the following ~/.xsessionrc

  $ cat .xsessionrc
  #! /bin/sh

  unset LC_ALL
  LANG=ja_JP.UTF-8
  LC_MESSAGES=en_GB.UTF-8
  LANGUAGE=${LC_MESSAGES}

  export LANG
  export LANGUAGE
  export LC_MESSAGES

At the ligthdm login screen, I confirmed that the selected language was
the first one in my system's /etc/locale.gen (aa_DJ.UTF-8) and selected
bo_IN.UTF-8 before logging in.

  $ cat .dmrc
  [Desktop]
  Language=bo_IN.utf8
  Session=lightdm-xsession

  $ locale
  LANG=bo_IN.utf8
  LANGUAGE=en_GB.UTF-8
  LC_CTYPE="bo_IN.utf8"
  LC_NUMERIC="bo_IN.utf8"
  LC_TIME="bo_IN.utf8"
  LC_COLLATE="bo_IN.utf8"
  LC_MONETARY="bo_IN.utf8"
  LC_MESSAGES=en_GB.UTF-8
  LC_PAPER="bo_IN.utf8"
  LC_NAME="bo_IN.utf8"
  LC_ADDRESS="bo_IN.utf8"
  LC_TELEPHONE="bo_IN.utf8"
  LC_MEASUREMENT="bo_IN.utf8"
  LC_IDENTIFICATION="bo_IN.utf8"
  LC_ALL=

As you can see, the LANG value is *not* as per ~/.xsessionrc which sets
and exports ja_JP.UTF-8.  However, the LC_MESSAGES and LANGUAGE
variables *are* as per ~/.xsessionrc.

Subsequent logins use ~/.dmrc to set the user's preceived language
preference when you enter the user name and move to the password field.
After login, the locale is as per above with the *wrong* LANG value.

> The lightdm greeter will select a locale based on .dmrc if it exists,
> but if the user chose another one in the menu, then it'll use that for
> LANG.

My "problem" is that I didn't select any language when I first
encountered the problem.  I just entered my user name and password at
the login screen.  That's all.
Actually, I don't think I ever bothered selecting a language via that
chooser interface.

> Then, at login, /etc/X11/Xsession is run, which in turns run-parts
> the scripts in /etc/X11/Xsession.d and especially
> 40x11-common_xsessionrc, so whatever you put in .xsessionrc will take
> precedence over previously set variables (and independantly of lightdm)
>
> I repeat, by the time .xsessionrc is parsed, lightdm or the greeter
> doesn't have a chance to do anything to modify the locale anymore.

If that is true, something else must be doing that.  Here's what's in my
/etc/X11/Xsession.d/:

  20x11-common_process-args
  30x11-common_xresources
  35x11-common_xhost-local
  40x11-common_xsessionrc
  50x11-common_determine-startup
  55xfce4-session
  60xdg-user-dirs-update
  70im-config_launch
  75dbus_dbus-launch
  90consolekit
  90gpg-agent
  90qt-a11y
  90x11-common_ssh-agent
  99x11-common_start

I have not changed /etc/X11/Xsession{,.options}

> On Tue, Jan 14, 2014 at 10:32:13AM +0100, Simon Pepping wrote:
>> Package: lightdm-gtk-greeter
>> Version: 1.6.1-5
>> Severity: normal
>> Tags: l10n
>> 
>> Dear Maintainer,
>> 
>> When I select my language once in the language selector, I want to be
>> logged in with that language on all subsequent log-ins, until I select
>> another language in the language selector. That does not happen. I am
>> always logged with the language of the system-wide locale, unless I
>> select a language in the language selector.

Hmm, system-wide locale being taken into account here.  Does not happen
for me, but I'm using

  $ cat /etc/default/locale 
  LANG="C"

which is not in /etc/locale.gen of course.

>> My language setting in ~/.xsessionrc is overwritten. Ideally, the
>> language selector would have a option which leaves the setting in such
>> a script unmodified.
>
> As said above, that's the case. Also, I repeat, .xsessionrc and the
> locale chooser in the lightdm greeters are *completely* unrelated, so
> it's best to separate the test cases. .xsessionrc variables will
> override whatever you set in the locale chooser, and you're then
> responsible for the behavior.

Wishing I was ;-)  As I showed above, the LANG variable gets clobbered
by something but LC_MESSAGE and LANGUAGE survive.

>>    * What led up to the situation?
>> 
>> I select english in the language selector and log in. Language is
>> english. I log out.
>> 
>> I make no selection in the language selector and log in. Language is
>> dutch.
>> 
>>    * What outcome did you expect instead?
>> 
>> I expect that subsequent log-ins use the earlier selected language,
>> i.e. english in my case.
>> 
>> Note that the locale setting below is the result of logging in with
>> english as the selected language.
>> 
>
> In the end, I'm pretty confused by those two bug reports. It seems that
> people are indeed confused by the lightdm/lightdm-gtk-greeter behavior
> wrt. locales, but the reports I get are merely adding confusion, not
> helping to reduce it.
>
> In order to detect issues in LightDM/lightdm-gtk greeter, it'd help to:
>
> - - not set anything locale related in .xsessionrc (since it'll just
>   override whatever lightdm set)

Problem is that /etc/X11/Xsession.d/40x11-common_xsessionrc advises you
to do so.

  $ head /etc/X11/Xsession.d/40x11-common_xsessionrc 
  # This file is sourced by Xsession(5), not executed.

  #Source user defined xsessionrc (locales and other environment variables)
  if [ -r "$USERXSESSIONRC" ]; then
    . "$USERXSESSIONRC"
  fi

> - - provide the full output of `locales' (and maybe the content of
>   $LANGUAGE too)

See above.

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