NetBSD Problem Report #50222

From www@NetBSD.org  Wed Sep  9 14:55:14 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8C275A567D
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  9 Sep 2015 14:55:14 +0000 (UTC)
Message-Id: <20150909145513.2EFCFA65CE@mollari.NetBSD.org>
Date: Wed,  9 Sep 2015 14:55:13 +0000 (UTC)
From: oshima-ya@yagoto-urayama.jp
Reply-To: oshima-ya@yagoto-urayama.jp
To: gnats-bugs@NetBSD.org
Subject: Backspace key does not erase, generates '^?' charactor in framebuffer conosole and ttyEx
X-Send-Pr-Version: www-1.0

>Number:         50222
>Category:       misc
>Synopsis:       Backspace key does not erase, generates '^?' charactor in framebuffer conosole and ttyEx
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 09 15:00:00 +0000 2015
>Last-Modified:  Tue Aug 02 02:50:01 +0000 2016
>Originator:     Yasushi Oshima
>Release:        NetBSD 7.0_RC3
>Organization:
>Environment:
NetBSD hassaku 7.0_RC3 NetBSD 7.0_RC3 (GENERIC.201508110747Z) amd64
>Description:
When login shell is /bin/csh or /bin/sh (without set -o emacs or -o vi) and execute tset(1),
Backspace key generates '^?' charactor, instead of erase one charactor.

% stty -a
(snip)
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^H; intr = ^C; kill = ^U; lnext = ^V;
        min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
        stop = ^S; susp = ^Z; time = 0; werase = ^W;

Because of this, 'kbs' in terminfo is '^H'.

% infocmp wsvt25 | grep kbs
        il1=\E[L, ind=\ED, is2=\E[r\E[25;1H, kbs=^H, kcub1=\E[D,
% infocmp vt100 | grep kbs
        ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=^H, kc1=\EOp, kc3=\EOn,

In /etc/ttys, the terminal type of console is vt100, and this of ttyyE? is wsvt25.

tset(1) sets the value of 'kbs' in terminfo to termios's c_cc[VERASE].

BTW, when remove tset line in .login for csh and re-login,

@@ -14,7 +14,7 @@
 endif

 set noglob
-eval `tset -s -m 'network:?xterm'`
+# eval `tset -s -m 'network:?xterm'`
 unset noglob
 stty status '^T' crt -tostop

The erase shows '^?'. but when run tset(1), it becames '^H'.

% stty -a 
(snip)
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
        min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
        stop = ^S; susp = ^Z; time = 0; werase = ^W;

% tset
% stty -a
(snip)
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^H; intr = ^C; kill = ^U; lnext = ^V;
        min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
        stop = ^S; susp = ^Z; time = 0; werase = ^W;

This problem will occur  not only in wsvt25 and vt100.
It will be occur in another terminal type which use system console(for example, TERM=x68k, the special console type for NetBSD/x68k).

>How-To-Repeat:
1. login to system from console or ttyE1,ttyE2,...
2. show stty(1) erase
3. exec tset(1)
4. show stty(1) erase again
5. push Backspace key in csh or input-mode of vi(1).

>Fix:
The default value of stty erase (which is termios.c_cc[VERASE]) is CERASE in /usr/include/sys/ttydefaults.h, this is 0177(='^?').

I think the value of 'kbs' in the terminal type entry in the terminfo database shall  be the same as this.

At least,  kbs=\177 in wsvt25 entry is required.

vt100 which is used for console, I don't know change or not the value of kbs. vt100 is very common type. Should change it to another type for pc console?



>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/50222: Backspace key does not erase, generates '^?' charactor in framebuffer conosole and ttyEx
Date: Wed, 9 Sep 2015 17:12:21 +0000 (UTC)

 oshima-ya@yagoto-urayama.jp writes:

 >Backspace key generates '^?' charactor, instead of erase one charactor.

 That's because the backspace key on your keyboard generates a keycode
 that is translated to ^? by wskbd. This is true for the keymap provided
 by pckbd, but the keymap from the ukbd driver maps the key to ^H.

 X11 will use the same keysym for either and xterm translates that keysym
 to ^H (or to ^? or to the VERASE value from the tty layer).


 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Yasushi Oshima <oshima-ya@yagoto-urayama.jp>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: misc/50222: Backspace key does not erase, generates '^?'
 charactor in framebuffer conosole and ttyEx
Date: Sat, 12 Sep 2015 00:52:02 +0900 (JST)

 mlelstv@serpens.de wrote:

 >  >Backspace key generates '^?' charactor, instead of erase one charactor.
 >  
 >  That's because the backspace key on your keyboard generates a keycode
 >  that is translated to ^? by wskbd. This is true for the keymap provided
 >  by pckbd, but the keymap from the ukbd driver maps the key to ^H.

 Thanks.

 I understood the keymap is not unified in wskbd. so it is not
 possible to cover the one terminfo type...

 I think the keymap of BS in wskbd (which is the NetBSD own device)
 may be unified (is this the same as CERASE of tty(4)?).

 Until then,
 I proposes to add a new wscons type in terminfo which has kbs=\177
 (wscons25kbs?) for users to enable select the type in /etc/ttys 
 depending on the keyboard.

 Thanks.
 --
 Yausushi Oshima

From: Matthew Mondor <mm_lists@pulsar-zone.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: misc/50222: Backspace key does not erase, generates '^?'
 charactor in framebuffer conosole and ttyEx
Date: Mon, 1 Aug 2016 22:49:22 -0400

 On Wed,  9 Sep 2015 15:00:00 +0000 (UTC)
 oshima-ya@yagoto-urayama.jp wrote:

 > >Number:         50222

 Please also see bin/51385.

 Thanks,

 -- 
 Matt

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.