After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 788762 - set_up_session_language() overrides user language settings set by pam_env with system defaults
set_up_session_language() overrides user language settings set by pam_env wit...
Status: RESOLVED OBSOLETE
Product: gdm
Classification: Core
Component: general
3.26.x
Other Linux
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2017-10-10 09:53 UTC by Olivier Tilloy
Modified: 2018-05-24 11:41 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Olivier Tilloy 2017-10-10 09:53:26 UTC
In Ubuntu, pam_env is used to source system and user language settings:

$ grep pam_env /etc/pam.d/gdm-password 
session required        pam_env.so readenv=1
session required        pam_env.so readenv=1 user_readenv=1 envfile=/etc/default/locale

This means that pam_env will first apply the system defaults in /etc/default/locale, and will then override them with the values in ~/.pam_environment. A system could have the default LANG set to en_US (that would be the language of the greeter) and a given user have fr_FR in their ~/.pam_environment to have their session in French.

However GDM appears to override again the language environment variables (LANG, LANGUAGE and LC_*) after pam has set them, in set_up_session_language(). This results in the language being reset to the system default.

This can easily be distro-patched in Ubuntu (simply commenting out the call to set_up_session_language() seems to do the trick), but I would like to understand if that function is still needed even for distros that don't use pam?


Corresponding ubuntu bug: https://bugs.launchpad.net/ubuntu-gnome/+bug/1662031.
Comment 1 Ray Strode [halfline] 2017-10-10 14:25:29 UTC
so it looks like set_up_session_language was added in commit c672e4e for bug 709105.

I guess what we probably need to do is call it earlier? Want to try to write a patch that does that?
Comment 2 Olivier Tilloy 2017-10-10 14:30:32 UTC
I had a quick look at the code and didn't manage to find the entry point for the session worker that calls pam. I'll give it another shot, but if you can point me to a safe place to move that call to set_up_session_language(), that would make it even easier.
Comment 3 Ray Strode [halfline] 2017-10-10 14:46:10 UTC
maybe on_setup_complete would be an okay place. or it could it do it before starting the worker with gdm_session_worker_job_set_environment
Comment 4 Olivier Tilloy 2017-10-11 04:56:12 UTC
It turns out calling set_up_session_language() earlier (e.g. in on_setup_complete_cb) doesn't fix the problem: gdm_session_start_session() calls send_environment(), which overrides the environment set up by pam with the values from /etc/default/locale again.

I guess not calling set_up_session_language() at all is the correct fix when using pam.
Comment 5 GNOME Infrastructure Team 2018-05-24 11:41:26 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdm/issues/338.