Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Nov 2001 18:51:18 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
Cc:        <freebsd-current@FreeBSD.ORG>
Subject:   Re: shell coredumps with missing termcap entries ?
Message-ID:  <20011109180918.E8067-100000@delplex.bde.org>
In-Reply-To: <200111012120.fA1LKCk25023@uriah.heep.sax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 1 Nov 2001, Joerg Wunsch wrote:

> Luigi Rizzo <luigi@FreeBSD.ORG> wrote:
>
> > I have been experiencing this problem for sometimes on CURRENT-based
> > picobsd images: the shell coredumps if it does not find an
> > entry for its terminal type in /etc/termcap.
>
> Seems to be a =BBfeature=AB of the new libedit.

Try this fix.  libedit now does more error checking, but doesn't check
the error codes properly.  It checks too much in term_init() so it
doesn't initialize the arrow keys.  Then it doesn't check enough in
term_init()'s caller[s], so it continues when there is no terminal and
soon uses the uninitialized arrow keys.  Continuing when there is no
terminal is correct and should give builtin defaults for a dumb terminal
like it used to.

Symptoms of the bug, at least on i386's: if malloc() returns zeroed
storage, then the uninitialized arrow keys are sort of initialized (to
0), and the arrow keys just don't work.  If malloc() returns the garbage
given by the default malloc options, then the uninitialized arrow keys
cause a core dump.

I still think the correct fix is to back out the libedit changes and
start over.

Index: term.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/lib/libedit/term.c,v
retrieving revision 1.15
diff -u -2 -r1.15 term.c
--- term.c=091 Oct 2001 08:41:25 -0000=091.15
+++ term.c=099 Nov 2001 07:30:51 -0000
@@ -339,7 +339,7 @@
 =09(void) memset(el->el_term.t_val, 0, T_val * sizeof(int));
 =09term_outfile =3D el->el_outfile;
+=09term_init_arrow(el);
 =09if (term_set(el, NULL) =3D=3D -1)
 =09=09return (-1);
-=09term_init_arrow(el);
 =09return (0);
 }

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011109180918.E8067-100000>