bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Serial Line boot may not properly clear the screen


From: Klaus Reichl
Subject: Serial Line boot may not properly clear the screen
Date: Fri, 18 Jan 2002 00:07:12 +0100

Hi serialized GRUBies,

For all running GRUB on serial consoles:

The AUTO_FILL logic may clobber the screen, when sending ESC
sequences.  The AUTO_FILL logic simply counts characters sent to the
console without taking into account that ESC sequences do not use
space on the terminal.

I've fixed one annoying situation, where the clear screen behavior
during boot depends on the number of characters in ESC sequences sent
before. 

NOTE: This is not a functional but esthetic problem, but testers or
test drivers are esthetes most of the time ;-).

REAL-NOTE: One of the serial line folks (maybe I should, but where's
the time) should browse through the code and find a way to encapsulate
ESC sequence sending to cleanly cooperate with the AUTO_FILL logic.

This fix, however, makes the boot sequence deterministic.  If
everybody agrees, I'll check it in. 

KR
--
                                        email: address@hidden 
Klaus Reichl                                   address@hidden
Danhausergasse 8/16                     voice: +43 (1) 27722 / 3884 (job)    
A-1040 Wien                                    +43 (1)    94 137 94 (private)
                                               +43 (6991) 94 137 94 (mobile)
 
Testcase is not trivial.  It's a number of boot entries sending
exactly so many characters, that the CLS escape sequence is destroyed
by a CR/LF inserted into it due to AUTO_FILL (thinking about it
theoretically is easier than forcing me to reconstruct the case where
I found the problem).

Here's the fix:

cvs diff -u ChangeLog stage2/char_io.c 
Index: ChangeLog
===================================================================
RCS file: /cvsroot/grub/grub/ChangeLog,v
retrieving revision 1.463
diff -u -r1.463 ChangeLog
--- ChangeLog   15 Jan 2002 10:32:21 -0000      1.463
+++ ChangeLog   17 Jan 2002 22:37:24 -0000
@@ -1,3 +1,9 @@
+2002-01-17  Klaus Reichl  <address@hidden>
+
+       * stage2/char_io.c (serial_cls): Protect CLS escape from
+       auto_fill.  Otherwise it's possible that an auto_fill CR/NL is put
+       into the escape sequence.
+
 2002-01-15  Yoshinori K. Okuji  <address@hidden>
 
        * configure.in (AM_INIT_AUTOMAKE): The version number is
Index: stage2/char_io.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/char_io.c,v
retrieving revision 1.43
diff -u -r1.43 char_io.c
--- stage2/char_io.c    30 Dec 2001 07:33:23 -0000      1.43
+++ stage2/char_io.c    17 Jan 2002 22:37:27 -0000
@@ -1290,7 +1290,14 @@
   if (terminal & TERMINAL_DUMB)
     grub_putchar ('\n');
   else
-    grub_printf ("\e[H\e[J");
+    {
+      int saved_auto_fill = auto_fill;
+
+      /* XXX this should be really checked/done with all ESC sequences */
+      auto_fill = 0;
+      grub_printf ("\e[H\e[J");
+      auto_fill = saved_auto_fill;
+    }
 }
 #endif /* SUPPORT_SERIAL */
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]