NetBSD Problem Report #56810

From www@netbsd.org  Fri Apr 29 02:04:39 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2A2D61A9239
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 29 Apr 2022 02:04:39 +0000 (UTC)
Message-Id: <20220429020438.09D521A923A@mollari.NetBSD.org>
Date: Fri, 29 Apr 2022 02:04:37 +0000 (UTC)
From: andrew.cagney@gmail.com
Reply-To: andrew.cagney@gmail.com
To: gnats-bugs@NetBSD.org
Subject: virsh+pexpect back-pressure causing console's tab-expanded space characters to be lost
X-Send-Pr-Version: www-1.0

>Number:         56810
>Category:       kern
>Synopsis:       virsh+pexpect back-pressure causing console's tab-expanded space characters to be lost
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 29 02:05:00 +0000 2022
>Originator:     Andrew Cagney
>Release:        NetBSD 9.2
>Organization:
>Environment:
KVM Guest: NetBSD netbsdw 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC i386
KVM Host: Linux 5.17.4-200.fc35.x86_64 #1 SMP PREEMPT Wed Apr 20 15:37:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

>Description:
The setup:

- Linux host

- a very vanilla NetBSD 9.2 guest

- the guest console is set up as:
# tty
/dev/constty
# dmesg | grep cons
[     1.000003] com0: console
# dmesg | grep com0
[     1.000003] com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
[     1.000003] com0: console
# stty
speed 9600 baud;
lflags: echoe echoke echoctl
oflags: onocr onlret
cflags: cs8 -parenb -hupcl clocal

(the baud rate was set low as higher speeds seemed to loose other characters, at least during the install)

- a python (pexpect - pty+tty) script wrapping <<virsh console>> and running on the host is being used to interact with the NetBSD console
the script sends shell commands and then captures the output writing it to a file

When the terminal is set up per above tabs are expanded to spaces, but some of the spaces get lost vis:

# setkey -D
192.1.2.23 192.1.2.45 
        esp mode=tunnel spi=2515219582(0x95eb347e) reqid=16389(0x00004005)
      E: aes-cbc  7a376fd9 4b7017be edf173db 839d44d9

when tab expansion is disabled, vis:

# stty -oxtabs
# setkey -D
192.1.2.23 192.1.2.45 
        esp mode=tunnel spi=2515219582(0x95eb347e) reqid=16389(0x00004005)
        E: aes-cbc  7a376fd9 4b7017be edf173db 839d44d9

there is no character loss.

- it seems to only be the tab-expanded space characters that are lost
- using virsh directly doesn't appear to have the problem
- using virsh+pexpect in "interact" mode also doesn't have the problem (so presumably its the effect of pexpect's pattern-matcher slowing down I/O)
- linux guests, using an identical setup and also using xon, don't suffer from this problem; its console is similar
[    0.727155] 00:00: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A


>How-To-Repeat:
Um.  See above for setup.  Can provide pexpect script if needed.

>Fix:
work-around is to disable tab expansion

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.