Subject: misc/28402: reset command does not work (termcap problem)
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
List: netbsd-bugs
Date: 11/23/2004 20:51:03
>Number:         28402
>Category:       misc
>Synopsis:       reset command does not work (termcap problem)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 23 20:51:03 +0000 2004
>Originator:     Pavel Cahyna
>Release:        NetBSD 2.0_BETA i386
>Organization:
>Environment:


System: NetBSD 2.0_BETA (GENERIC_DIAGNOSTIC s patchem D. Reeda - PR#26839) #4: Wed Oct  6 10:13:10 CEST 2004
	pavel@pc.martani.n2.repy.czf:/mnt/obj/kompilace/jadra/compile/GENERIC_DIAGNOSTIC



>Description:


if a console program crashes, the reset command is supposed to get the terminal to a 
clean state, but it fails to do so in both xterm and wscons. What it does is to output 
the "rs" sequence, but many terminal types (including wsvt25, vt220 and xterm) don't 
have such sequence defined. Some (as the vt220) have only "r2" sequence, which is 
terminfo only, and more, this doesn't work either even if renamed to "rs". 

Terminfo on linux has rs1, rs2 and rs3. rs1 seems to do the job on xterm (where it is defined
as Esc c), but not on vt220 (where it is Esc   [   ?   3   l).


>How-To-Repeat:


to simulate the effect of a crashed application, type tput vi. The cursor disappears.
Now type reset in an attempt to restore it. Nothing happens. ssh to a linux host and type 
reset there. The cursor is restored properly (in xterm, not in wscons, here even reset on 
linux fails).


>Fix:


find the hard reset strings in ttys documentation and add them as the rs capability
to /usr/share/misc/termcap.
For both xterm and wscons, adding rs=\Ec works (this is rs1 in the linux terminfo entry for 
xterm). According to the xterm documentation
(ftp://invisible-island.net/xterm/ctlseqs.txt.gz), this escape sequence should be standard
on DEC ttys, but I do not have any VT100 to test it.