Subject: Re: bug#30505: marionette/virtio-console issues lead to test failures

From: Danny Milosavljevic <[email-masked]>
Date: Mon, 19 Feb 2018 23:35:53 +0100

Hi Ludo,

On Mon, 19 Feb 2018 21:35:05 +0100
[email-masked] (Ludovic Courtès) wrote:

> > It was a bad idea to do the "\x1b%G" in the first place.  
> 
> Because it’s redundant with IUTF8?

I meant because the Linux kernel does it already and it's better not to
have random multi-byte racy writes onto the tty while the mingetty
is starting up (and possibly buffering and pending half of another sequence).

As far as I understand it's not redundant to do both.

According to src/Linux/linux-4.12-rc2/drivers/tty/vt/vt.c, the 'G' controls
the conversion utf-8->unicode that happens before the virtual terminal
displays a corresponding character on the screen.

On the other hand, the termios iutf8 is meant for the program running in the session.

Say you have bash on vt1, then bash can check termios for the settings and find
out whether vt1 is UTF-8-capable (also has other settings like whether the
terminal already supports line editing etc - old-school terminals were quite
cool; a friend of mine salvaged a real one ^^).

Note that drivers/tty/vt/vt.c only copies ONE way, from the 'G' flag to the
termios (and that seldomly).
Makes sense since the programs shouldn't have a say in what the terminal can do :)

So I'd say guix services fiddling with termios is ... weird and the 'G' slightly
less weird.

> This ‘unicode-start’ procedure is essentially a port of the
> ‘unicode_start’ script from ‘kbd’.  I suppose the justification is to
> make sure we’re using UTF-8 input regardless of what the kernel defaults
> or command-line options are.

Yeah, but it's asking for trouble.

I just checked Linux 2.6.32.1, it defaults to utf8 (IUTF8 in termios, and 'G').

I'd suggest to remove both.