Bug#221290: [Pkg-shadow-devel] Bug#221290: Bug #221290 still here: screen garbled after entering high-ascii characters at login prompt

Tomasz Kłoczko kloczek at zie.pg.gda.pl
Tue Sep 27 16:36:51 UTC 2005


On Tue, 27 Sep 2005, Eugeniy Meshcheryakov wrote:

> 27 вересня 2005 о 07:38 +0200 Christian Perrier написав(-ла):
> > I was waiting for upstream resync to deal with this bug report but it
> > still seems to be here.
> > 
> > When entering high-ascii characters at the login prompt (usually by
> > mistake), such as "é", and then hitting Backspace to remove them,
> > they're not erased at the prompt...and, when entering the correct
> > login and validating, login switched the terminal to all-caps.
> You can switch terminal to all-caps more easyly: just enter you login in
> all-caps and then password as usual. So, I think it (all-caps) is normal
> behavior (for historic reasons probably).
> 
> > 
> > This happens in the Linux console. Nothing bad happens in a terminal,
> > eitheer UTF-8 or ISO....
> Because terminal you have used do not support all-caps mode ;)
> 
> I tried to look at problem with erasing of characters and found that
> kernel uses undocumented (in termios(3)) flag IUTF8. If this flag is not
> set kernel tty driver will interpret characters as single-byte. So some
> program should set this flag when terminal is in UTF8 mode... 
> 
> Attached patch fixes this problem for 'login' when it run under UTF-8
> locale. But on usual system it is run under C locale :(. So, I think
> some other program should do this (console-tools/kbd?), but this will
> not fix problem for terminal emulators :(.

Eugeniy this is incorrect way .. better will be use IUTF8 atribute 
from tty level description. Example from my system:

$ stty -a | grep utf
-iuclc ixany imaxbel -iutf8

Why this is better ? Because termios is more generic and using 
nl_langinfo() requires LOCALE database in system which does not exist 
usualy in embeded systems (because it is very huge and full i18n support 
isn't neccessary on this kind instalations).
Also reading current LOCALE settings it not the same as reading terminal
capabilities (IIRC setlocale() also changes tty atributes .. if not this 
is next thing for fix :).

By default linux console device have UTF-8 support enabled. Also current 
glibc provides IUTF8 bit mask for reading this atribute (look at 
<bits/termios.h>) .. so all around is ready. Only IUTF8 atribute must be 
correctly readed and used .. nothing more. Of cource also it will be good 
if stty comand will correctly report IUTF8 :) (I don't know is attached 
patch which bases on SuSE patch is used in Debian coreutils).

IMO problem is for fix in shadow 4.0.14. Before will be good send 
broadcast message to FC, Mandriva, Gentoo and other main distribution 
maintainers with call for patching coreutils (attached patch bases on SuSE 
fix). Also it will be good inform coreutils maintainer for commit attached 
patch in next coreutils release (anyone have good contact with coreutils 
maintainer ?).

On release shadow 4.0.13 I'll add TODO entry with short description about
plan use IUTF8 tty atribute in login.

kloczek
-- 
-----------------------------------------------------------
*Ludzie nie mają problemów, tylko sobie sami je stwarzają*
-----------------------------------------------------------
Tomasz Kłoczko, sys adm @zie.pg.gda.pl|*e-mail: kloczek at rudy.mif.pg.gda.pl*
-------------- next part --------------
--- coreutils-5.2.1//src/stty.c
+++ coreutils-5.2.1//src/stty.c
@@ -232,6 +232,9 @@
 #ifdef IMAXBEL
   {"imaxbel", input, SANE_SET | REV, IMAXBEL, 0},
 #endif
+#ifdef IUTF8
+  {"iutf8", input, SANE_UNSET | REV, IUTF8, 0},
+#endif
 
   {"opost", output, SANE_SET | REV, OPOST, 0},
 #ifdef OLCUC
@@ -581,6 +584,9 @@
    [-]istrip     clear high (8th) bit of input characters\n\
 "), stdout);
       fputs (_("\
+ * [-]iutf8      assume UTF-8 encoding\n\
+"), stdout);
+      fputs (_("\
  * [-]iuclc      translate uppercase characters to lowercase\n\
  * [-]ixany      let any character restart output, not only start character\n\
    [-]ixoff      enable sending of start/stop characters\n\
@@ -682,7 +688,7 @@
    -raw          same as cooked\n\
 "), stdout);
       fputs (_("\
-   sane          same as cread -ignbrk brkint -inlcr -igncr icrnl\n\
+   sane          same as cread -ignbrk brkint -inlcr -igncr icrnl -iutf8\n\
                  -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr\n\
                  -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\n\
                  isig icanon iexten echo echoe echok -echonl -noflsh\n\


More information about the Pkg-shadow-devel mailing list