[Bug 440371] New: XIM script overwrites LANG variable incorrectly
https://bugzilla.novell.com/show_bug.cgi?id=440371 Summary: XIM script overwrites LANG variable incorrectly Product: openSUSE 11.1 Version: Beta 3 Platform: Other OS/Version: Other Status: NEW Severity: Major Priority: P5 - None Component: Basesystem AssignedTo: mfabian@novell.com ReportedBy: jpr@novell.com QAContact: qa@suse.de CC: mmeeks@novell.com, werner@novell.com, hpj@novell.com Found By: --- gdm (and xdm/kdm) executes /etc/X11/xdm/Xsession, which executes/sources /etc/X11/xinit/xinitrc.common which executes/sources /etc/X11/xim. Xsession sets LANG based on the second parameter passed to it (which may not be the default set in /etc/sysconfig/language). The xim script executes a function called adduserenv to fix bug 235044, however exec -l -a ${SHELL##*/} $SHELL -c printenv dumps the environment of a login shell, which will use the default language set in /etc/sysconfig/language because of /etc/profile.d/lang.sh unless a user has explicitly set LANG in ~/.profile. Hence LANG will be reset to the default language every time - the goal however was too only reset if ~/.profile explicitly set to override. Overall this approach is broken though, because if a user *explicitly* set a different language in the gdm login screen, I don't think even ~/.profile should over ride a more immediate choice. Please make adduserenv only handle INPUT method if anything at all The gnome session itself used to work around this by finding GDM_LANG and setting LANG again, but it no longer has this work around upstream. I have straces if need be with debug echo's, but hopefully the above explains it. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User werner@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c1
--- Comment #1 from Dr. Werner Fink
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mmeeks@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c2
Michael Meeks
https://bugzilla.novell.com/show_bug.cgi?id=440371
User werner@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c3
--- Comment #3 from Dr. Werner Fink
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c4
--- Comment #4 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c5
--- Comment #5 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c6
--- Comment #6 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c7
--- Comment #7 from JP Rosevear
Michael> so; as I understand it, currently when using GDM the user Michael> always gets the system default language - so this is rather Michael> important to fix; bumping prio.
Currently I cannot select the language in GDM at all, see bug #435157, it is greyed out.
Yes, I fixed that locally, but testing found this bug. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c8
JP Rosevear
Remark: If gdm overwrites LANG or not isn't known afterwards. IMHO gdm should export an additional variable like LANG_OVERRIDE to give any script sourced/executed later the possibility to detect the other value of the language variable. Maybe this could be done within /etc/X11/xdm/Xsession but only if every display manager uses the same method for commiting LANG. That is not exporting LANG but providing an option to /etc/X11/xdm/Xsession.
Read Xsession - every display manager has at least the option of passing the LANG there and having it set. The hack in the xim script renders this code in Xsession completely useless. (In reply to comment #5 from Mike Fabian)
GDM could set the INPUT_METHOD variable to any of names of the files (not directories) in /etc/X11/xim.d. If INPUT_METHOD is set, the file with that name in /etc/X11/xim.d is sourced to start an input method.
And the LANG variable would still be blown away. (In reply to comment #4 from Mike Fabian)
Werner> I'm not willingly to overwrite the settings in ~/.profile as Werner> this is personal stuff set by the user its self.
Yes, I also think so. If a user has enough knowledge to edit his ~/.profile to set LANG and LC_ variables, this should certainly be used with the highest priority.
Why? If the user selects a language in gdm different than the default, they have made a more immediate choice than ~/.profile. Even if you want this, its still broken when no language is actually in ~/.profile - because the xim script starts a bash login which sets LANG to the default variable. This is clearly not what is intended in bug 235044 - only if ~/.profile has LANG set do you want to use. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c9
--- Comment #9 from JP Rosevear
https://bugzilla.novell.com/show_bug.cgi?id=440371
User werner@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c10
--- Comment #10 from Dr. Werner Fink
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c11
--- Comment #11 from JP Rosevear
If the user hard codes the LANG variable in its ~/.profile it is his choise. Maybe the GDM_LANG variable should be documented to enable the user to use a boolean for set or not set the LANG variable.
No, it is broken even if the user does *not* hardcode LANG in ~/.profile. If a user simply picks a language in gdm that is not the system default, it is broken.
I've added the lines of comment #3 to lang.sh respectivly to lang.csh. AFAIK GDM is currently the only Display Manager which overrides the LANG variable.
Wrong. GDM does not override the LANG variable, Xsession does based on the parameters passed to it. And GDM_LANG is GDM specific, what if you login to gnome from kdm or kde from gdm. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c12
--- Comment #12 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c13
--- Comment #13 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User werner@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c14
Dr. Werner Fink
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c15
--- Comment #15 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c16
--- Comment #16 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User werner@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c17
--- Comment #17 from Dr. Werner Fink
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c18
--- Comment #18 from JP Rosevear
JP> If the user selects a language in gdm different than the default, JP> they have made a more immediate choice than ~/.profile.
OK, I see your point.
So if gdm sets LANG (by the way, does it set LANG or GDM_LANG?) we could detect that it is already set in xim, couldn’t we?
It sets LANG and GDM_LANG, but more importantly in passes GDM_LANG as the second variable to Xsession - which explicitly sets LANG. Werner is listed as the author of this script. The comment is "Handle arguments given by xdm/kdm/gdm".
I.e. in "adduserenv" in /etc/X11/xim set only these variables which are not already set. If they are already set for whatever reason, don’t overwrite the but use them as they are.
It will be set no matter what I think, because Xsession is executed in a shell. adduserenv runs a bash login shell, which resets LANG to default and that value is used to replace LANG in the env (because LANG *might* have changed due to ~/.profile, but not usually).
Would that be OK?
(If gdm sets GDM_LANG and not LANG, we might need to copy the value of GDM_LANG into LANG).
The Xsession script essentially does this, since $GDM_LANG is passed to it as the second variable. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c19
--- Comment #19 from JP Rosevear
Werner> if test -n "$GDM_LANG ; then Werner> adduserenv INPUT_METHOD Werner> else Werner> adduserenv LANG LC_CTYPE LC_ALL INPUT_METHOD Werner> fi
I still prefer gdm overriding ~/.profile, but for now why can't ~/.profile be the input to the adduserenv for checking these vars instead of launching a bash login shell and doing printenv. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c20
--- Comment #20 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c21
--- Comment #21 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c22
--- Comment #22 from JP Rosevear
JP> adduserenv runs a bash login shell, which resets LANG to default
the login shell doesn’t yet replace LANG in the environment, the "eval" in adduserenv does. So we still have the option here not to replace some variables in some circumstances.
Yes, correct. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c23
--- Comment #23 from JP Rosevear
JP> > Werner> if test -n "$GDM_LANG ; then JP> > Werner> adduserenv INPUT_METHOD JP> > Werner> else JP> > Werner> adduserenv LANG LC_CTYPE LC_ALL INPUT_METHOD JP> > Werner> fi JP> JP> I still prefer gdm overriding ~/.profile,
Yes, but the above Werner-code does this, doesn’t it? As I read it, it doesn’t override LANG anymore if GDM_LANG is set so it allows gdm to override any LANG which might be in ~/.profile.
Yes, but its not really clean because the code in Xsession and xim still conflicts in general. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c24
--- Comment #24 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c25
--- Comment #25 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c26
--- Comment #26 from JP Rosevear
I just discussed with Werner and thought that checking in his code in /etc/X11/xim would be a good solution.
Where is there a still conflict after adding this code? I cannot see a conflict.
The conflict is that Xsession supports passing LANG and xim breaks it (now I guess not in the gdm case, but still..) Work around will work for now, thanks. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c27
--- Comment #27 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c28
Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c29
--- Comment #29 from Mike Fabian
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c30
--- Comment #30 from JP Rosevear
https://bugzilla.novell.com/show_bug.cgi?id=440371
User jpr@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c31
JP Rosevear
https://bugzilla.novell.com/show_bug.cgi?id=440371
User mfabian@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=440371#c32
Mike Fabian
participants (1)
-
bugzilla_noreply@novell.com