public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
@ 2007-04-03  1:24 Antonino A. Daplas
  2007-04-03  4:06 ` Alexander E. Patrakov
  2007-04-03 16:20 ` Pavel Machek
  0 siblings, 2 replies; 9+ messages in thread
From: Antonino A. Daplas @ 2007-04-03  1:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux Kernel Development, Jan Engelhardt, Paul LeoNerd Evans,
	H. Peter Anvin

Create a variable, default_utf8, that defines the system-wide default UTF-8
setting.  This variable can be altered via sysfs. If the variable is properly
set, this should mimimize breakage of UTF-8 encoded consoles when doing a
reset or echo -e '\033c' and of newly opened/allocated consoles.

This is based from patches by Jan Engelhardt and Paul LeoNerd Evans.

Signed-off-by: Antonino Daplas <adaplas@gmail.com>
---
> I think you're missing the whole point of console reset.  Its purpose is 
> to force the console into a known-good state.  The fewer pieces of state 
> it leaves unset, the better.  To some degree it's less important what 
> that state actually is.

Okay, you convinced me. Hopefully this is acceptable to all parties.

Andrew,

If everybody agrees, can you drop the previous patch I sent to you, and use
this instead?

Tony

 drivers/char/vt.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 1bbb45b..8aca96f 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -157,6 +157,8 @@ static void blank_screen_t(unsigned long
 static void set_palette(struct vc_data *vc);
 
 static int printable;		/* Is console ready for printing? */
+static int default_utf8;
+module_param(default_utf8, int, S_IRUGO | S_IWUSR);
 
 /*
  * ignore_poke: don't unblank the screen when things are typed.  This is
@@ -1497,7 +1499,7 @@ static void reset_terminal(struct vc_dat
 	vc->vc_charset		= 0;
 	vc->vc_need_wrap	= 0;
 	vc->vc_report_mouse	= 0;
-	vc->vc_utf		= 0;
+	vc->vc_utf              = default_utf8;
 	vc->vc_utf_count	= 0;
 
 	vc->vc_disp_ctrl	= 0;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
  2007-04-03  1:24 [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs Antonino A. Daplas
@ 2007-04-03  4:06 ` Alexander E. Patrakov
  2007-04-03  5:47   ` Antonino A. Daplas
  2007-04-03 16:20 ` Pavel Machek
  1 sibling, 1 reply; 9+ messages in thread
From: Alexander E. Patrakov @ 2007-04-03  4:06 UTC (permalink / raw)
  To: Antonino A. Daplas
  Cc: Andrew Morton, Linux Kernel Development, Jan Engelhardt,
	Paul LeoNerd Evans, H. Peter Anvin

Antonino A. Daplas wrote:
> Create a variable, default_utf8, that defines the system-wide default UTF-8
> setting.  This variable can be altered via sysfs. If the variable is properly
> set, this should mimimize breakage of UTF-8 encoded consoles when doing a
> reset or echo -e '\033c' and of newly opened/allocated consoles.
> 
> This is based from patches by Jan Engelhardt and Paul LeoNerd Evans.
> 
> Signed-off-by: Antonino Daplas <adaplas@gmail.com>
> ---
>> I think you're missing the whole point of console reset.  Its purpose is 
>> to force the console into a known-good state.  The fewer pieces of state 
>> it leaves unset, the better.  To some degree it's less important what 
>> that state actually is.
> 
> Okay, you convinced me. Hopefully this is acceptable to all parties.
> 
> Andrew,
> 
> If everybody agrees, can you drop the previous patch I sent to you, and use
> this instead?
> 
> Tony
> +static int default_utf8;
> +module_param(default_utf8, int, S_IRUGO | S_IWUSR);

Module parameter without description and documentation? Yes, I understand 
that it is impossible to make vt a module. How about adding a line to 
Documentation/kernel-parameters.txt?

Other than that, the patch looks like a useful change.

-- 
Alexander E. Patrakov

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
  2007-04-03  4:06 ` Alexander E. Patrakov
@ 2007-04-03  5:47   ` Antonino A. Daplas
  0 siblings, 0 replies; 9+ messages in thread
From: Antonino A. Daplas @ 2007-04-03  5:47 UTC (permalink / raw)
  To: Alexander E. Patrakov
  Cc: Andrew Morton, Linux Kernel Development, Jan Engelhardt,
	Paul LeoNerd Evans, H. Peter Anvin

On Tue, 2007-04-03 at 10:06 +0600, Alexander E. Patrakov wrote:
> Antonino A. Daplas wrote:
> > Create a variable, default_utf8, that defines the system-wide default UTF-8
> > setting.  This variable can be altered via sysfs. If the variable is properly
> > set, this should mimimize breakage of UTF-8 encoded consoles when doing a
> > reset or echo -e '\033c' and of newly opened/allocated consoles.
> > 
> > This is based from patches by Jan Engelhardt and Paul LeoNerd Evans.
> > 
> > Signed-off-by: Antonino Daplas <adaplas@gmail.com>
> > ---
> >> I think you're missing the whole point of console reset.  Its purpose is 
> >> to force the console into a known-good state.  The fewer pieces of state 
> >> it leaves unset, the better.  To some degree it's less important what 
> >> that state actually is.
> > 
> > Okay, you convinced me. Hopefully this is acceptable to all parties.
> > 
> > Andrew,
> > 
> > If everybody agrees, can you drop the previous patch I sent to you, and use
> > this instead?
> > 
> > Tony
> > +static int default_utf8;
> > +module_param(default_utf8, int, S_IRUGO | S_IWUSR);
> 
> Module parameter without description and documentation? Yes, I understand 
> that it is impossible to make vt a module. How about adding a line to 
> Documentation/kernel-parameters.txt?

I'll do that (and I'll also include Jan's palette patch) once I'm sure
there's no violent objection against the change.

Tony 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
  2007-04-03  1:24 [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs Antonino A. Daplas
  2007-04-03  4:06 ` Alexander E. Patrakov
@ 2007-04-03 16:20 ` Pavel Machek
  2007-04-03 16:35   ` Paul LeoNerd Evans
  1 sibling, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2007-04-03 16:20 UTC (permalink / raw)
  To: Antonino A. Daplas
  Cc: Andrew Morton, Linux Kernel Development, Jan Engelhardt,
	Paul LeoNerd Evans, H. Peter Anvin

Hi!

> Create a variable, default_utf8, that defines the system-wide default UTF-8
> setting.  This variable can be altered via sysfs. If the variable is properly
> set, this should mimimize breakage of UTF-8 encoded consoles when doing a
> reset or echo -e '\033c' and of newly opened/allocated consoles.

HPA is right... this should be fixed in userland. Reset should reset a
console, and if you want utf-8, do \ec\ewhatever to get it.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
  2007-04-03 16:20 ` Pavel Machek
@ 2007-04-03 16:35   ` Paul LeoNerd Evans
  2007-04-04  5:39     ` Antonino A. Daplas
  0 siblings, 1 reply; 9+ messages in thread
From: Paul LeoNerd Evans @ 2007-04-03 16:35 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Antonino A. Daplas, Andrew Morton, Linux Kernel Development,
	Jan Engelhardt, Paul LeoNerd Evans, H. Peter Anvin

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

On Tue, Apr 03, 2007 at 04:20:52PM +0000, Pavel Machek wrote:
> HPA is right... this should be fixed in userland. Reset should reset a
> console, and if you want utf-8, do \ec\ewhatever to get it.

As I've already said elsewhere, does anything say that "reset" means
that UTF-8 is turned off, or merely reset back to some known state? I
personally would consider that UTF-8 being on is the default, and if
something wants it off it should ask specifically..

Consider any other terminal emulator, such as those running on X11; when
they're reset, they know to keep UTF-8 mode turned on, because it said
so in their config, or in the locale. Kernel doesn't really have nice
access to the LANG environment variable, but we can give it something
similar; namely, via a module parameter.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
  2007-04-03 16:35   ` Paul LeoNerd Evans
@ 2007-04-04  5:39     ` Antonino A. Daplas
  2007-04-04  8:01       ` Pavel Machek
  0 siblings, 1 reply; 9+ messages in thread
From: Antonino A. Daplas @ 2007-04-04  5:39 UTC (permalink / raw)
  To: Paul LeoNerd Evans
  Cc: Pavel Machek, Andrew Morton, Linux Kernel Development,
	Jan Engelhardt, H. Peter Anvin

On Tue, 2007-04-03 at 17:35 +0100, Paul LeoNerd Evans wrote:
> On Tue, Apr 03, 2007 at 04:20:52PM +0000, Pavel Machek wrote:
> > HPA is right... this should be fixed in userland. Reset should reset a
> > console, and if you want utf-8, do \ec\ewhatever to get it.
> 
> As I've already said elsewhere, does anything say that "reset" means
> that UTF-8 is turned off, or merely reset back to some known state? I
> personally would consider that UTF-8 being on is the default, and if
> something wants it off it should ask specifically..
> 
> Consider any other terminal emulator, such as those running on X11; when
> they're reset, they know to keep UTF-8 mode turned on, because it said
> so in their config, or in the locale. Kernel doesn't really have nice
> access to the LANG environment variable, but we can give it something
> similar; namely, via a module parameter.

I agree with Paul.  Reset or RIS is (R)eset to (I)nitial (S)tate,
represented as ESC 06/03. "Initial state" is defined in ECMA-48 as the
state of the device after it was made operational. It doesn't
necessarily mean that the "initial state" is the safest configuration.
So, if this "initial state" includes enabling UTF-8, then the device has
to go into UTF-8 upon invoking RIS.

Tony


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
  2007-04-04  5:39     ` Antonino A. Daplas
@ 2007-04-04  8:01       ` Pavel Machek
  2007-04-06 14:30         ` Paul LeoNerd Evans
  2007-04-06 15:39         ` H. Peter Anvin
  0 siblings, 2 replies; 9+ messages in thread
From: Pavel Machek @ 2007-04-04  8:01 UTC (permalink / raw)
  To: Antonino A. Daplas
  Cc: Paul LeoNerd Evans, Andrew Morton, Linux Kernel Development,
	Jan Engelhardt, H. Peter Anvin

Hi!

> > > HPA is right... this should be fixed in userland. Reset should reset a
> > > console, and if you want utf-8, do \ec\ewhatever to get it.
> > 
> > As I've already said elsewhere, does anything say that "reset" means
> > that UTF-8 is turned off, or merely reset back to some known state? I
> > personally would consider that UTF-8 being on is the default, and if
> > something wants it off it should ask specifically..
> > 
> > Consider any other terminal emulator, such as those running on X11; when
> > they're reset, they know to keep UTF-8 mode turned on, because it said
> > so in their config, or in the locale. Kernel doesn't really have nice
> > access to the LANG environment variable, but we can give it something
> > similar; namely, via a module parameter.
> 
> I agree with Paul.  Reset or RIS is (R)eset to (I)nitial (S)tate,
> represented as ESC 06/03. "Initial state" is defined in ECMA-48 as the
> state of the device after it was made operational. It doesn't
> necessarily mean that the "initial state" is the safest configuration.
> So, if this "initial state" includes enabling UTF-8, then the device has
> to go into UTF-8 upon invoking RIS.

You could do that... during development series. But this is
userspace-visible API change, and those are not allowed during stable.

...and having /sysctl configuring inital state for reset is just plain
ugly.


									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
  2007-04-04  8:01       ` Pavel Machek
@ 2007-04-06 14:30         ` Paul LeoNerd Evans
  2007-04-06 15:39         ` H. Peter Anvin
  1 sibling, 0 replies; 9+ messages in thread
From: Paul LeoNerd Evans @ 2007-04-06 14:30 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Antonino A. Daplas, Paul LeoNerd Evans, Andrew Morton,
	Linux Kernel Development, Jan Engelhardt, H. Peter Anvin

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

On Wed, Apr 04, 2007 at 10:01:40AM +0200, Pavel Machek wrote:
> You could do that... during development series. But this is
> userspace-visible API change, and those are not allowed during stable.
> 
> ...and having /sysctl configuring inital state for reset is just plain
> ugly.

Well, how else would you suggest to do it? Bearing in mind all other
terminal emulators (xterm, gnome-terminal, konsole, and so on) all have
other out-of-band ways to determine this - config files, menu options,
locale variables,... None of those are particularlly viable for the
kernel. I vote this is the closest thing we've got.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs
  2007-04-04  8:01       ` Pavel Machek
  2007-04-06 14:30         ` Paul LeoNerd Evans
@ 2007-04-06 15:39         ` H. Peter Anvin
  1 sibling, 0 replies; 9+ messages in thread
From: H. Peter Anvin @ 2007-04-06 15:39 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Antonino A. Daplas, Paul LeoNerd Evans, Andrew Morton,
	Linux Kernel Development, Jan Engelhardt

Pavel Machek wrote:
> 
> You could do that... during development series. But this is
> userspace-visible API change, and those are not allowed during stable.
> 

Only if you change the default setting.

	-hpa

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-04-06 15:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-03  1:24 [PATCH] vt: Expose system-wide UTF-8 default setting via sysfs Antonino A. Daplas
2007-04-03  4:06 ` Alexander E. Patrakov
2007-04-03  5:47   ` Antonino A. Daplas
2007-04-03 16:20 ` Pavel Machek
2007-04-03 16:35   ` Paul LeoNerd Evans
2007-04-04  5:39     ` Antonino A. Daplas
2007-04-04  8:01       ` Pavel Machek
2007-04-06 14:30         ` Paul LeoNerd Evans
2007-04-06 15:39         ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox