Bug#526741: creates faulty terminal instructions

martin f krafft madduck at debian.org
Sun May 3 08:01:14 UTC 2009


Package: grub-pc
Version: 1.96+20090317-1
Severity: important
File: /etc/grub.d/00_header
Tags: patch

If any non-default (e.g. serial) terminal is chosen, grub.d/00_header since
(but not including) lenny writes to grub.cfg something similar to the
following:

  serial --unit=0 --speed=115200
  if terminal_output serial ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal serial
  fi

This causes correct terminal output, but since terminal_input is not
called, I cannot actually interact with grub.

The cause for this seems to be the split of $GRUB_TERMINAL into
$GRUB_TERMINAL_INPUT and $GRUB_TERMINAL_OUTPUT without
backwards-compatibility in place.

This patch is one way to solve it; there are others, but I thought
this was transparent/explicit enough. In particular, I chose not to
use ${GRUB_TERMINAL_INPUT:=${GRUB_TERMINAL_OUTPUT}} because I find
that a bit obfuscated:

---8<---8<---
--- /etc/grub.d/00_header      2009-05-03 09:54:08.000000000 +0200
+++ /etc/grub.d/00_header      2009-05-03 09:57:36.000000000 +0200
@@ -40,6 +40,8 @@
 set timeout=${GRUB_TIMEOUT}
 EOF
 
+[ -z "${GRUB_TERMINAL_INPUT}" ] && GRUB_TERMINAL_INPUT=${GRUB_TERMINAL_OUTPUT}
+
 case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
   serial:* | *:serial)
     if ! test -e ${grub_prefix}/serial.mod ; then
---8<---8<---

I found it quite confusing that 00_header gets
$GRUB_TERMINAL_OUTPUT (but not $GRUB_TERMINAL), even though
$GRUB_TERMINAL is set in /etc/default/grub.

Anyway, setting $GRUB_TERMINAL_INPUT to $GRUB_TERMINAL_OUTPUT if it
is undefined makes sense to me.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- 
 .''`.   martin f. krafft <madduck at d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20090503/9875f931/attachment.pgp>


More information about the Pkg-grub-devel mailing list