Subject: kern/1922: [dM] stty -echo echonl doesn't work right
To: None <gnats-bugs@gnats.netbsd.org>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: netbsd-bugs
Date: 01/10/1996 08:46:58
>Number:         1922
>Category:       kern
>Synopsis:       [dM] stty -echo echonl doesn't work right
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 10 09:05:01 1996
>Last-Modified:
>Originator:     der Mouse
>Organization:
	Dis-
>Release:        -current according to sup as of 11 Dec 1995
>Environment:
	Tested on Sun-3/150, believed present on all.
>Description:
	Due to a reversed test, stty -echo echonl (which is supposed to
	echo just newlines), instead echoes everything _but_ newlines.
>How-To-Repeat:
	Noticed by code inspection, but it's easy to verify:
	% /bin/stty -echo echonl ; cat > /dev/null
	Type and notice that everything but newlines echoes.
	Then check termios(4) and see that ECHONL is commented as
	"echo NL even if ECHO is off", and that the associated text
	says "If ECHONL and ICANON are set, the `\n' character echoes
	even if ECHO is not set.".
>Fix:
	Fix the test in ttyecho.  Untested diff:

--- /sys/kern/tty.c     Wed Oct 18 14:53:46 1995
+++ tty.c       Wed Jan 10 08:43:02 1996
@@ -1765,7 +1765,7 @@
        if (!ISSET(tp->t_state, TS_CNTTB))
                CLR(tp->t_lflag, FLUSHO);
        if ((!ISSET(tp->t_lflag, ECHO) &&
-           (!ISSET(tp->t_lflag, ECHONL) || c == '\n')) ||
+           (!ISSET(tp->t_lflag, ECHONL) || c != '\n')) ||
            ISSET(tp->t_lflag, EXTPROC))
                return;
        if (ISSET(tp->t_lflag, ECHOCTL) &&

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu
>Audit-Trail:
>Unformatted: