Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Dec 1999 22:15:20 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        charon@freethought.org
Cc:        current@FreeBSD.ORG, peter@FreeBSD.ORG
Subject:   Re: minor bug in ee?
Message-ID:  <Pine.BSF.4.10.9912022132150.2281-100000@alphplex.bde.org>
In-Reply-To: <3.0.5.32.19991202005411.00a39cb0@nsit-popmail.uchicago.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2 Dec 1999 charon@freethought.org wrote:

> I recently noticed that ^v (the scroll down a page command in ee) must be
> entered twice to scroll down once (i.e. if you hit ^v once it won't do
> anything, you must hit it again) on a 4.0-CURRENT system.  As far as I can
> recall, this has been happening for as long as I've been tracking -CURRENT
> (~1 month), and still continues on the system I updated as of Nov. 30.
> 3-STABLE (as of Dec. 1) doesn't have this problem - it has a simple
> one-to-one ratio for ^v / scroll down.  As far as I can recall, none of the
> other 3.x or 2.x releases had this problem either.
> 
> I doubt this is very important - should I file a PR or anything?

This is the classic IEXTEN bug.  The interaction of IEXTEN with ICANON is
implementation-defined.  In FreeBSD, IEXTEN is independent of ICANON.
Buggy software doesn't know this and leaves IEXTEN set in "raw" mode.
This normally leaves ^V as the lnext character.

This bug, as it affects ee, is another libncurses bug.  The old libcurses
never had it, and it was "fixed" in in rev.1.4 of lib_raw.c in the old
libncurses.  Here is the "fix" cleaned up and merged into the current
lib_raw.c:

Index: ncurses/tinfo/lib_raw.c
===================================================================
RCS file: /home/ncvs/src/contrib/ncurses/ncurses/tinfo/lib_raw.c,v
retrieving revision 1.1.1.1
diff -c -2 -r1.1.1.1 lib_raw.c
*** lib_raw.c	1999/08/24 01:06:44	1.1.1.1
--- lib_raw.c	1999/12/02 10:39:01
***************
*** 75,78 ****
--- 75,82 ----
  #endif /* TRACE */
  
+ #ifdef TERMIOS
+ static tcflag_t iexten = 0;
+ #endif
+ 
  int raw(void)
  {
***************
*** 89,93 ****
  #ifdef TERMIOS
  		BEFORE("raw");
! 		cur_term->Nttyb.c_lflag &= ~(ICANON|ISIG);
  		cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT);
  		cur_term->Nttyb.c_cc[VMIN] = 1;
--- 93,99 ----
  #ifdef TERMIOS
  		BEFORE("raw");
! 		if (iexten == 0)
! 			iexten = cur_term->Nttyb.c_lflag & IEXTEN;
! 		cur_term->Nttyb.c_lflag &= ~(ICANON|ISIG|IEXTEN);
  		cur_term->Nttyb.c_iflag &= ~(COOKED_INPUT);
  		cur_term->Nttyb.c_cc[VMIN] = 1;
***************
*** 158,162 ****
  #ifdef TERMIOS
  	BEFORE("noraw");
! 	cur_term->Nttyb.c_lflag |= ISIG|ICANON;
  	cur_term->Nttyb.c_iflag |= COOKED_INPUT;
  	AFTER("noraw");
--- 164,168 ----
  #ifdef TERMIOS
  	BEFORE("noraw");
! 	cur_term->Nttyb.c_lflag |= ISIG|ICANON|iexten;
  	cur_term->Nttyb.c_iflag |= COOKED_INPUT;
  	AFTER("noraw");

Problems with this fix: `iexten' shouldn't exist.  The IEXTEN setting for
the "noraw" state should be obtained from the original setting or forced
on or off.

Unfixed nearby problems: About 27 termios flags must be set (on or off)
for raw mode (see libc/gen/termios.c:cfmakeraw()), but raw() only sets
about 5 of them.

Bruce



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9912022132150.2281-100000>