NetBSD Problem Report #38101

From Wolfgang.Stukenbrock@nagler-company.com  Mon Feb 25 09:35:29 2008
Return-Path: <Wolfgang.Stukenbrock@nagler-company.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 7C76663B853
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 25 Feb 2008 09:35:29 +0000 (UTC)
Message-Id: <20080225093509.C438A5FB649@s010.nagler-company.com>
Date: Mon, 25 Feb 2008 10:35:09 +0100 (CET)
From: Wolfgang.Stukenbrock@nagler-company.com
Reply-To: Wolfgang.Stukenbrock@nagler-company.com
To: gnats-bugs@gnats.NetBSD.org
Subject: pkgsrc - misc/screen failed to start on tty if BREAK is pending
X-Send-Pr-Version: 3.95

>Number:         38101
>Category:       pkg
>Synopsis:       pkgsrc - misc/screen failed to start on tty if BREAK is pending
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 25 09:40:00 +0000 2008
>Originator:     Wolfgang Stukenbock
>Release:        NetBSD 4.0 pkgsrc-2007Q4
>Organization:
Dr. Nagler & Company GmbH

>Environment:


System: NetBSD s010 4.0 NetBSD 4.0 (NSW-S010) #16: Wed Feb 20 12:51:34 CET 2008 wgstuken@s012:/export/NetBSD-4.0/N+C-build/.OBJDIR_amd64/export/NetBSD-4.0/src/sys/arch/amd64/compile/NSW-S010 amd64
Architecture: x86_64
Machine: amd64
>Description:
	The package screen-4.0.3 failes to start on a tty when a break is pending on that interface.
	We are using screen as a console-multiplexer for the serial console of several servers.
	Screen will be started during system boot in detached mode from an rc-file.
	If in such case a break signal is pending on one of the interfaces screen is gooing to open
	during startup, screen will catch a SIGINT some milliseconds after opening the affected
	interface. At this time the SIGINT will terminate screen, so that it will not come up.
	Later - after startup has completed - screen will ignore SIGINT on the interface, but that is too late ...

	The problem can be "fixed" by turning the "brkint" flag off on such interfaces. Accedently
	the distribution does not allow to set the brkint flag while opening the tty port.
	Setting this flag by a "exec !.. stty -brkint" on the just created window is too late,
	screen will not come there - it dies before.
	Therfore it makes sence to add the brkint to the flags recognized on the creation command line.

	Due to the fact that kern/28678 is still not fixed, the following patch will also add support
	to set vmin and vtime on the command line.
>How-To-Repeat:
	No realy easy to reproduce ...
	You need a machine and start screen during startup e.g. with
	"/usr/pkg/bin/screen -m -d -S cons_screen -c /root/.cons_screenrc".
	Than you need a permant pending BREAK signal on one tty-line - we have had this situation on one
	line of a cyclades card (cy - driver).
	The rc-file (/root/.cons_screenrc) for screen should contain something like
	  "screen -h 10000 -t s011 2 /dev/dtyCY004 38400,cs8,ixon,ixoff,-istrip"
	  "exec !.. stty min 1 time 0"
	Remark: the second line is required as workaround for the bug reported in kern/28678.

	Whenn you boot the machine, screen tries to start, but will get SIGINT and dies while setting up the window.
>Fix:
	The following patch will add support to process vmin, vtime and [-]brkint on the creation command line.
	With this patch you can start the window with
	"screen -h 10000 -t s011 2 /dev/dtyCY004 38400,cs8,ixon,ixoff,-istrip,-brkint,vmin=1,vtime=0"
	without any problem.

	Remark: this fix should work on any architecture screen supports. This assumes that "m->tio.c_cc" is present
	on all architectures, but the screen implemantation assumes this too as fare as I've seen.

	I've send this info to "screen@uni-erlangen.de" too. This address is noted as the bug-report address in
	the doku files of screen.

	Start of Patch for tty.sh:

--- tty.sh.orig	2008-02-25 09:32:06.000000000 +0100
+++ tty.sh	2008-02-25 09:45:41.000000000 +0100
@@ -743,6 +743,22 @@
 	  m->tio.c_cflag &= ~CRTSCTS;
 #endif
 	}
+      else if (!strncmp("brkint", opt, 6))
+	{
+IF{BRKINT}	m->tio.c_iflag |= BRKINT;
+	}
+      else if (!strncmp("-brkint", opt, 7))
+	{
+IF{BRKINT}	m->tio.c_iflag &= ~BRKINT;
+	}
+      else if (!strncmp("vmin=", opt, 5) && opt[5] >= '0' && opt[5] <= '9')
+	{
+	  m->tio.c_cc[VMIN] = atoi(&opt[5]) & 0xff;
+	}
+      else if (!strncmp("vtime=", opt, 6) && opt[6] >= '0' && opt[6] <= '9')
+	{
+	  m->tio.c_cc[VTIME] = atoi(&opt[6]) & 0xff;
+	}
       else
         return -1;
       while (*opt && !index(sep, *opt)) opt++;

>Unformatted:

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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.