Bug 663900

Summary: RFE: getty: fix up locale settings for CIJK languages when run on console
Product: [Fedora] Fedora Reporter: A S Alam <aalam>
Component: util-linux-ngAssignee: Karel Zak <kzak>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: extras-orphan, i18n-bugs, iarlyy, jonathan, kzak, lpoetter, metherid, mitr, mschmidt, mshao, notting, petersen, plautrba, tagoh, tmraz
Target Milestone: ---Keywords: i18n, Regression, Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-07 05:11:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 617261    

Description A S Alam 2010-12-17 09:20:04 UTC
Description of problem:
While installed Rawhide in particular language (Hindi/hi_IN), try to switch Virtual Terminal (with Alt+Ctrl+F2/F3..), then After entering user name, Password is shown in Local language, where it failed to display (only square characters are shown).

Version-Release number of selected component (if applicable):


How reproducible:
Every time

Steps to Reproduce:
1. Change System Language to Hindi (hi_IN)
2. (reboot and at) GDM Screen, switch to Virtual Terminal 2/3
3. enter any user nam
4. check password

Actual results:
text 'password' is in local language

Expected results:
that should be in English as Indic Languages are not rendering in Terminal

Additional info:
Fedora 14 is showing in English

Comment 1 iarly selbir 2010-12-17 12:02:47 UTC
Despite it be a i18 bug, It seems to need some fix from initscript.

Thanks for your report.


--
Fedora Bugzappers Team

Comment 2 Bill Nottingham 2010-12-17 20:00:40 UTC
I suspect systemd is starting gettys in the system locale; earlier inits did not set the locale for their child processes.

Comment 3 Lennart Poettering 2011-01-04 23:00:35 UTC
Hmm, I would argue that systemd is doing the right thing here by passing the locale env to getty/login. Ad that getty/login is doing the wrong thing when it gets these env vars passed.

It seems login should not translate some strings it currently translates. Reassigning to login/util-linux.

Comment 4 Bill Nottingham 2011-01-05 20:07:19 UTC
The 'password' prompt may be coming from PAM.

Comment 5 Tomas Mraz 2011-01-05 21:38:19 UTC
I'm sorry, but the prompt is translated and will stay translated in the PAM modules. The PAM modules do not know (well they can find out the service but it does not make any sense to query it for this purpose) which environment they are running in and other applications might well expect to get the strings translated. So the locale env variables should be unset in getty probably.

Comment 6 Miloslav Trmač 2011-01-05 21:40:35 UTC
Skipping translation of only some strings is not an correct fix - and it would be a regression for non-English locales that can be displayed correctly.

The problem is not application-specific - the Linux console can not display all required glyphs.  Thus the locale should not ever be set one of the far Eastern locales for any process running on the console in in the first place.

See what /etc/profile.d/lang.sh is doing (at least on F14).  Whatever process sets the locale for the getty/login/shell process subtree running on the console needs to do something similar.

Comment 7 Lennart Poettering 2011-01-05 22:47:36 UTC
Well, we can definitely reset LANG explicitly for the gettys we spawn. That way things will work again as they always did. That will ensure that the prompts are in english again, which is good for indian languages -- but is not that great for languages using latin letters.

i.e. this way because the console cannot do indian letters we'd be unable to show "Kennwort:" instead of "Password:" for de_DE. Not ideal either.

Comment 8 Miloslav Trmač 2011-01-05 22:51:01 UTC
Again, see what /etc/profile.d/lang.sh does.

Comment 9 Karel Zak 2011-01-05 23:11:16 UTC
Note that agetty(8) and  login(1) use locales. The originally used mingetty(8) is without locale support.

Comment 10 Lennart Poettering 2011-01-05 23:49:19 UTC
(In reply to comment #8)
> Again, see what /etc/profile.d/lang.sh does.

Well, lang.sh doesn't look right to me. i.e. log in on the console with indian locale, then lang.sh will fix this for you. But, then connect from there via ssh to another machine which also uses indian locale. You'll get indian chars from the other machine because TERM is passed on via ssh, but LANG isn't, and the tty type will not be vt but pty.

So, if we do care about proper localization for getty/login, then at some place we'd have to do the logic from lang.sh (but with the problem i pointed out above fixed) and that logic would need to run somwhere as part of getty/login so that its effect are visible in getty/login already. 

Karel, what's your opinion about adding this ugly hack to agetty?

The right fix of course would be to introduce some mechanism which could tell gettext/glibc/whatever to use UTF8 on the console, but avoid the indian chars or so.

I will now unset LANG before spawning getty. That's the short term fix. Given that console is crufty anyway maybe that's simply where we should leave things and then forget about them.

Comment 11 Lennart Poettering 2011-01-06 19:51:09 UTC
systemd git now unsets all locale settings when spawning a getty on the console. This should fix the immediate problem. I will now reassign this to util-linux as RFE in the hope that agetty maybe can be extended with a local blacklist of some sorts (for example /etc/vtlocale.blacklist), that patches the locale iff it is run on the console and the locale is set to one of the indian languages. Such fixup code will always be ugly, but if we do it we probably should do it as part of the initializaiton of getty (and not later, post-login), so that getty itself can be translated.

Comment 12 Miloslav Trmač 2011-01-06 20:49:46 UTC
There are two separate locales.

* Locale used in the login process.  This uses the system locale.  I don't really have an opinion about whether this should be set in systemd or in *getty.

* Locale used in the session after login.  This is a _per-user_ setting (~/.i18n), and I don't see much reason to handle this in the privileged *getty process - having it in profile.d/lang.sh is quite fine IMHO, and it handles all login methods.  The ssh problem from comment #10 remains, but that's neither here or there - if the profile.d/lang.sh functionality were moved to *getty, it should also be provided inside sshd, and the lack of information applies to sshd just as well as to profile.d/lang.sh.

Comment 13 Miloslav Trmač 2011-01-07 14:45:55 UTC
(In reply to comment #12)
> There are two separate locales.
> 
> * Locale used in the login process.  This uses the system locale.  I don't
> really have an opinion about whether this should be set in systemd or in
> *getty.

Actually... To the extent systemd can write status or error messages to the Linux console, systemd itself should, eventually, also set the system locale and do the filtering (because, eventually, the messages should support translation).

I still can't see a clear reason to "logically" place the responsibility for filtering the locale should be to systemd or to the various programs that use the console (i.e. should getty set the locale and filter it, and should gdm set the locale and not filter it, or should both be handled by systemd?) - but if the code needs to exist inside systemd anyway, placing the responsibility with systemd would probably result in the simplest design.

I.e. systemd would be responsible for setting locales for services it starts, and could be configured to filter it for services that use the Linux console.  None of the system-wide daemons would care about /etc/sysconfig/i18n, parsing it, or worry about filtering the data.

Ideally it should be possible to share the locale filtering code between systemd and profile.d/lang.sh (e.g. a script that gets the L* environment variables on stdin and outputs filtered settings on stdout), but that's probably just too much bike shedding from me.

Comment 14 A S Alam 2011-01-07 14:55:51 UTC
just small update - languages includes Indian + CJK (Asian) and
bug #652513 (need some exception to have LANG=en_US in grub.conf for CIJK) can be reference

Comment 15 Akira TAGOH 2011-01-11 01:30:28 UTC
This issue should be duplicate of Bug #652513.

*** This bug has been marked as a duplicate of bug 652513 ***

Comment 16 Tomas Mraz 2011-01-11 07:44:53 UTC
Reopening. The discussion here is not closed and the other bug is not too informative.

Comment 17 Akira TAGOH 2011-01-27 07:54:15 UTC
Any updates on the dicsussion? if it's a bit hard to get this fixed in f15 time frame, I'd like to push a workaround in grubby for this issue though. I'm pretty sure getting rid of LANG or set non-CJKI locales to LANG in the kernel parameter helps for this at least.

Comment 18 Akira TAGOH 2011-03-09 05:48:00 UTC
I don't see this issue on f15 alpha anymore. in /etc/systemd/getty.target.wants/getty@tty?.service:


# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=LANG= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGE= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=

Is that a fix for this issue right?

Comment 19 Miloslav Trmač 2011-03-09 11:56:30 UTC
If so, shouldn't it include LC_ALL as well?

Comment 20 Akira TAGOH 2011-03-09 12:39:10 UTC
if there are any way to give it a process, right.

Comment 21 Lennart Poettering 2011-03-09 14:49:02 UTC
(In reply to comment #18)
> I don't see this issue on f15 alpha anymore. in
> /etc/systemd/getty.target.wants/getty@tty?.service:
> 
> 
> # Unset locale for the console getty since the console has problems
> # displaying some internationalized messages.
> Environment=LANG= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY=
> LC_MESSAGE= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT=
> LC_IDENTIFICATION=
> 
> Is that a fix for this issue right?

Yes, it should be.

Comment 22 Lennart Poettering 2011-03-09 14:50:12 UTC
(In reply to comment #19)
> If so, shouldn't it include LC_ALL as well?

systemd will never set LC_ALL itself, since that is mostly an environment variable mostly useful to override the normal settings you do with LANG and the other LC_xxx variables. Since systemd won't set this var we hence don't need to unset it in the getty.

Comment 23 Akira TAGOH 2011-03-31 05:29:24 UTC
(In reply to comment #21)
> (In reply to comment #18)
> > I don't see this issue on f15 alpha anymore. in
> > /etc/systemd/getty.target.wants/getty@tty?.service:
> > 
> > 
> > # Unset locale for the console getty since the console has problems
> > # displaying some internationalized messages.
> > Environment=LANG= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY=
> > LC_MESSAGE= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT=
> > LC_IDENTIFICATION=
> > 
> > Is that a fix for this issue right?
> 
> Yes, it should be.

Thanks. let's close this or change the bug status to MODIFIED at least then :)
changing to MODIFIED so far. that would be better if confirming by someone else as well.

Comment 24 Jens Petersen 2011-04-07 05:11:28 UTC
Looks good to me too.  Thanks!