Date: Mon, 16 Jan 2017 13:00:01 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Slawa Olhovchenkov <slw@zxy.spb.ru> Cc: Julian Elischer <julian@elischer.org>, Mark Johnston <markj@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, svn-src-head@freebsd.org, rang@acm.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r311952 - head/sys/ddb Message-ID: <20170116122019.E1170@besplex.bde.org> In-Reply-To: <20170115144531.GB58505@zxy.spb.ru> References: <201701120022.v0C0MaHq053076@repo.freebsd.org> <20170113131948.P1465@besplex.bde.org> <20170114220629.GB18065@raichu> <1755552c-a5e2-848a-38e2-3bacfbecfb23@elischer.org> <20170115144531.GB58505@zxy.spb.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 15 Jan 2017, Slawa Olhovchenkov wrote: > On Sun, Jan 15, 2017 at 01:07:58PM +0800, Julian Elischer wrote: > >> >> the old DEC machines had (from memory) ^O which dropped all pending >> output. >> Not so useful when there is 2MB of network buffers queued up to you, >> but very useful on >> and asr-33 teletype. > > Now it useful too, on serial console. > ^O processing be present years ago in FreeBSD, but removed at time of > tty code rewrite. As I know patch for restore exist, nobody > review/commit. Urk. I have fixes for hundreds of things broken in the rewrite, but didn't notice this one. The only fix I have near here is a partial one for funky quoting of control characters according to ECHOK and ECHOKE. ECHOK is a POSIX feature and ECHOKE is a BSD feature. The man page still docoments the old behaviour. Grepping for CCEQ (and its renaming to the worse name CMP_FLAG in the rewrite) shows that the only other control character with lost support is VDSUSP. Zgrepping for VDISCARD and VDSUSP in /usr/share/man shows the following bugs: - VDISCARD and VDSUSP are listed but not described in any useful way in termios(4) - VDSUSP (and dsusp) is listed but not described in any useful way in stty(1) - VDISCARD (and discard) are not mentioned in stty(1). However, 'stty discard c' works, and stty's display of the discard character works. stty's displays exactly the special characters that used to work. - VDISCARD and VDSUSP are otherwise undocumented. - FLUSHO in termios(4) and flusho in stty(1) are listed and described, but their close connection with VDISCARD is not mentioned (except stty says "being discarded"). FLUSHO is mostly an internal flag. In the working version, It is normally toggled by VDISCARD but is cleared by other actions. It can also be controlled by an ioctl, and stty supports the ioctl. But settings by stty are rarely useful since it is normally cleared by other The patch in the PR doesn't handle the other actions right. actions which stty can't control. Partial fixes for ECHOKE and nearby things: X Index: tty_ttydisc.c X =================================================================== X --- tty_ttydisc.c (revision 312117) X +++ tty_ttydisc.c (working copy) X @@ -798,6 +842,16 @@ X } X } else { X /* Don't print spaces. */ X + /* X + * XXX broken if VERASE is disabled. Can get here X + * then if ECHO is off and: X + * - for VERASE2 if that is not disabled X + * - for the buggy ECHOK/ECHOKE cases X + * - perhaps in other cases. X + * This routine is too generic. X + * X + * XXX the logic is not just non-printing of spaces. X + */ X ttydisc_echo(tp, tp->t_termios.c_cc[VERASE], 0); X } X } X @@ -993,7 +1049,30 @@ X ttydisc_rubchar(tp); X return (0); X } else if (CMP_CC(VKILL, c)) { X +#if 0 X + /* X + * XXX broken. This doesn't even look at ECHOK or X + * ECHOKE (nothing does now), and it doesn't produce X + * the documented behaviour of ECHOK. ECHOK exists X + * to be a non-erasing version of ECHOKE that uses X + * fewer terminal capabilities. ECHOPRT is also X + * broken (never even looked at). X + */ X while (ttydisc_rubchar(tp) == 0); X +#else X + if (CMP_FLAG(l, ECHOKE)) { X + /* XXX too hard to fix. */ X + while (ttydisc_rubchar(tp) == 0) X + ; X + } else { X + ttydisc_echo_force(tp, c, 0); X + if (CMP_FLAG(l, ECHOK)) X + ttydisc_echo_force(tp, '\n', 0); X + while (ttyinq_peekchar(&tp->t_inq, &c, X + "e) == 0) X + ttyinq_unputchar(&tp->t_inq); X + } X +#endif X return (0); X } else if (CMP_FLAG(l, IEXTEN)) { X if (CMP_CC(VWERASE, c)) { X @@ -1021,12 +1100,13 @@ X X parmrk: X if (CMP_FLAG(i, PARMRK)) { X - /* Prepend 0xff 0x00 0x.. */ X + /* Prepend 0xff 0x00. */ X ob[2] = c; X ol = 3; X quote = 1; X } else { X - ob[0] = c; X + /* Kill the character for read(). Keep it in c for echoing. */ X + ob[0] = '\0'; X ol = 1; X } X Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170116122019.E1170>