Subject: kern/793: sgtty fails to reset line modes
To: None <gnats-admin@NetBSD.ORG>
From: None <darcy@druid.planix.com>
List: netbsd-bugs
Date: 02/11/1995 09:35:05
>Number:         793
>Category:       kern
>Synopsis:       sgtty fails to reset line modes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 11 09:35:02 1995
>Originator:     D'Arcy J.M. Cain
>Organization:
D'Arcy J.M. Cain (darcy@druid.com)  |   Democracy is three wolves and a
Planix, Inc., Toronto, Canada       |   sheep voting on what's for dinner.
+1 416 424 2871  (DoD#0082) (eNTP)  |
      -- Info on Planix can be found at http://www.planix.com --
>Release:        1.0
>Environment:
	
System: NetBSD druid 1.0 NetBSD 1.0 (DRUID) #35: Thu Feb 9 16:44:16 EST 1995 root@druid:/usr/src/sys/arch/i386/compile/DRUID i386


>Description:
	Programs that use sgtty don't read the original line discipines
	correctly and so fail to reset them properly on exit.  The
	problem is that ttcompatgetflags assumes that the line was
	previously set by ttcompatsetflags.  This is generally not
	the case.  Note that xterms don't seem to care whether cs7
	or cs8 is set so it is easy to miss this unless you are
	working from a terminal.
>How-To-Repeat:
	from a relatively recently booted system:
	$ stty cs8
	$ pine # or other program that uses sgtty
	$ stty -a # this should show character size set to 7.
>Fix:
	One is temped to replace sgtty.h with the single line;

	#error Do not use sgtty - use termios instead.

	But the current routines can be improved by changing tty_compat.c
	as follows:

	261c261
	<		if ((tp->t_flags & LITOUT) && !(oflag & OPOST))
	---
	>		if (oflag & OPOST)
	263,264c263
	<			if (tp->t_flags & PASS8)
	<				flags |= PASS8;
	---
	>			flags |= PASS8;

>Audit-Trail:
>Unformatted: