NetBSD Problem Report #20834

Received: (qmail 8856 invoked by uid 605); 21 Mar 2003 12:16:25 -0000
Message-Id: <200303211218.h2LCI3G07258@test.co.uk>
Date: Fri, 21 Mar 2003 12:18:03 GMT
From: netbsd@precedence.co.uk
Sender: gnats-bugs-owner@netbsd.org
Reply-To: netbsd@precedence.co.uk
To: gnats-bugs@gnats.netbsd.org
Subject: Dialog doesn't work over telnet
X-Send-Pr-Version: 3.95

>Number:         20834
>Category:       pkg
>Synopsis:       dialog doesn't receive Return keypresses over telnet
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jdc
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 21 12:17:00 +0000 2003
>Closed-Date:    Sat Apr 05 18:46:50 +0000 2003
>Last-Modified:  Sat Apr 05 18:46:50 +0000 2003
>Originator:     Stephen Borrill
>Release:        NetBSD 1.6_STABLE
>Organization:
Precedence Technologies Ltd
>Environment:


System: NetBSD newbuild 1.6_STABLE NetBSD 1.6_STABLE (PCFW1.6) #0: Wed Nov 6 11:49:32 GMT 2002 root@newbuild:/usr/src/cvs/syssrc/sys/arch/i386/compile/PCFW1.6 i386
Architecture: i386
Machine: i386
>Description:
When running dialog over a telnet connection, press Return has no effect and thus
no options can be chosen.

This happens on all 1.6 machines. Terminal type appears to be unimportant (tried xterm and vt220).
>How-To-Repeat:
Install misc/dialog package onto a machine. Connect into that machine with telnet from an X session 
or a console. Type:

dialog --yesno test 10 5

Then hit Return, nothing will happen. You may change the option with the left and right arrows, but
you are unable to make a choice leaving you no option but to Ctrl-C.
>Fix:
Make dialog use devel/ncurses.
This is linked in with pkg/16286 in which the fix didn't go far enough. dialog simply does not work
properly with the in-tree curses. Therefore, the dialog Makefile should at least be altered to:
INCOMPAT_CURSES=       NetBSD-1.5-* NetBSD-1.5.*-* NetBSD-1.6-* NetBSD-1.6_*-* NetBSD-1.6.*-*

Or perhaps, better:
INCOMPAT_CURSES=        NetBSD-*-*

Or even:
USE_NCURSES=	YES
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: jdc 
State-Changed-When: Tue Apr 1 10:24:37 PST 2003 
State-Changed-Why:  
Sent proposed fix. 


Responsible-Changed-From-To: pkg-manager->jdc 
Responsible-Changed-By: jdc 
Responsible-Changed-When: Tue Apr 1 10:24:37 PST 2003 
Responsible-Changed-Why:  
I'm looking after this. 

From: Julian Coleman <jdc@coris.demon.co.uk>
To: netbsd@precedence.co.uk
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/20834: dialog doesn't receive Return keypresses over telnet
Date: Tue, 1 Apr 2003 19:25:48 +0100

 This looks like a bug in the nl()/nonl() handling in the curses wgetch()
 function.  The following patch fixes it for me.  Could you test it, please?

 If it's OK, I'll commit it and change the INCOMPAT_CURSES line in the
 dialog package Makefile.

 There is a newer version of dialog (0.9b) at:

 	http://invisible-island.net/dialog/

 I'll look at updating the package to that version too.

 J

  ---8<---------------------------- Cut here ---------------------------->8---
 diff -ur /usr/src/lib/libcurses/curses.c ./curses.c
 --- /usr/src/lib/libcurses/curses.c	Mon Aug  5 11:04:48 2002
 +++ ./curses.c	Tue Apr  1 15:32:27 2003
 @@ -45,11 +45,11 @@
  #include "curses.h"

  /* Private. */
 -int	__echoit = 1;			 /* If stty indicates ECHO. */
 +int	__echoit = 1;			/* If stty indicates ECHO. */
  int	__pfast;
 -int	__rawmode = 0;			 /* If stty indicates RAW mode. */
 -int	__noqch = 0;			 
 -					 /* If terminal doesn't have
 +int	__rawmode = 0;			/* If stty indicates RAW mode. */
 +int	__nl = 1;			/* Translate cr to nl on input */
 +int	__noqch = 0;			/* If terminal doesn't have
  					 * insert/delete line capabilities
  					 * for quick change on refresh.
  					 */
 diff -ur /usr/src/lib/libcurses/curses_private.h ./curses_private.h
 --- /usr/src/lib/libcurses/curses_private.h	Tue Feb 18 11:03:07 2003
 +++ ./curses_private.h	Tue Apr  1 15:01:28 2003
 @@ -227,6 +227,7 @@
  	int echoit;
  	int pfast;
  	int rawmode;
 +	int nl;
  	int noqch;
  	int clearok;
  	int useraw;
 @@ -308,6 +309,7 @@
  extern int		 __endwin;
  extern int		 __pfast;
  extern int		 __rawmode;
 +extern int		 __nl;
  extern int		 __noqch;
  extern attr_t		 __mask_op, __mask_me, __mask_ue, __mask_se;
  extern struct __winlist	*__winlistp;
 diff -ur /usr/src/lib/libcurses/getch.c ./getch.c
 --- /usr/src/lib/libcurses/getch.c	Tue Feb 18 11:03:07 2003
 +++ ./getch.c	Tue Apr  1 15:28:08 2003
 @@ -847,8 +847,8 @@
  	if (is_wintouched(win))
  		wrefresh(win);
  #ifdef DEBUG
 -	__CTRACE("wgetch: __echoit = %d, __rawmode = %d, flags = %#.4x\n",
 -	    __echoit, __rawmode, win->flags);
 +	__CTRACE("wgetch: __echoit = %d, __rawmode = %d, __nl = %d, flags = %#.4x\n",
 +	    __echoit, __rawmode, __nl, win->flags);
  #endif
  	if (__echoit && !__rawmode) {
  		cbreak();
 @@ -932,6 +932,9 @@

  	if (weset)
  		nocbreak();
 +
 +	if (__nl && inp == 13)
 +		inp = 10;

  	return ((inp < 0) || (inp == ERR) ? ERR : inp);
  }
 diff -ur /usr/src/lib/libcurses/initscr.c ./initscr.c
 --- /usr/src/lib/libcurses/initscr.c	Tue Jan 28 11:03:41 2003
 +++ ./initscr.c	Tue Apr  1 15:01:39 2003
 @@ -79,6 +79,7 @@
  	__echoit = _cursesi_screen->echoit;
          __pfast = _cursesi_screen->pfast;
  	__rawmode = _cursesi_screen->rawmode;
 +	__nl = _cursesi_screen->nl;
  	__noqch = _cursesi_screen->noqch;
  	COLS = _cursesi_screen->COLS;
  	LINES = _cursesi_screen->LINES;
 diff -ur /usr/src/lib/libcurses/screen.c ./screen.c
 --- /usr/src/lib/libcurses/screen.c	Tue Feb 18 11:03:07 2003
 +++ ./screen.c	Tue Apr  1 15:02:24 2003
 @@ -62,6 +62,7 @@
  		old_screen->echoit = __echoit;
  		old_screen->pfast = __pfast;
  		old_screen->rawmode = __rawmode;
 +		old_screen->nl = __nl;
  		old_screen->noqch = __noqch;
  		old_screen->winlistp = __winlistp;
  		old_screen->COLS = COLS;
 @@ -78,6 +79,7 @@
  	__echoit = new->echoit;
          __pfast = new->pfast;
  	__rawmode = new->rawmode;
 +	__nl = new->nl;
  	__noqch = new->noqch;
  	COLS = new->COLS;
  	LINES = new->LINES;
 @@ -125,7 +127,7 @@

  	new_screen->infd = infd;
  	new_screen->outfd = outfd;
 -	new_screen->echoit = 1;
 +	new_screen->echoit = new_screen->nl = 1;
          new_screen->pfast = new_screen->rawmode = new_screen->noqch = 0;
  	new_screen->nca = A_NORMAL;
  	new_screen->color_type = COLOR_NONE;
 diff -ur /usr/src/lib/libcurses/tty.c ./tty.c
 --- /usr/src/lib/libcurses/tty.c	Fri Jan 10 11:03:28 2003
 +++ ./tty.c	Tue Apr  1 15:32:33 2003
 @@ -124,6 +124,11 @@
  	}

  	screen->baset = screen->orig_termios;
 +#ifdef DEBUG
 +	__CTRACE("baset.c_oflag = 0x%x\n", screen->baset.c_oflag);
 +	__CTRACE("baset.c_iflag = 0x%x\n", screen->baset.c_iflag);
 +	__CTRACE("baset.c_lflag = 0x%x\n", screen->baset.c_lflag);
 +#endif
  	screen->baset.c_oflag &= ~OXTABS;

  	screen->GT = 0;	/* historical. was used before we wired OXTABS off */
 @@ -169,6 +174,9 @@
  int
  raw(void)
  {
 +#ifdef DEBUG
 +	__CTRACE("raw()\n");
 +#endif
  	/* Check if we need to restart ... */
  	if (_cursesi_screen->endwin)
  		__restartwin();
 @@ -185,6 +193,9 @@
  int
  noraw(void)
  {
 +#ifdef DEBUG
 +	__CTRACE("noraw()\n");
 +#endif
  	/* Check if we need to restart ... */
  	if (_cursesi_screen->endwin)
  		__restartwin();
 @@ -201,6 +212,9 @@
  int
  cbreak(void)
  {
 +#ifdef DEBUG
 +	__CTRACE("cbreak()\n");
 +#endif
  	/* Check if we need to restart ... */
  	if (_cursesi_screen->endwin)
  		__restartwin();
 @@ -218,6 +232,9 @@
  int
  nocbreak(void)
  {
 +#ifdef DEBUG
 +	__CTRACE("nocbreak()\n");
 +#endif
  	/* Check if we need to restart ... */
  	if (_cursesi_screen->endwin)
  		__restartwin();
 @@ -376,6 +393,9 @@
  int
  echo(void)
  {
 +#ifdef DEBUG
 +	__CTRACE("echo()\n");
 +#endif
  	/* Check if we need to restart ... */
  	if (_cursesi_screen->endwin)
  		__restartwin();
 @@ -387,6 +407,9 @@
  int
  noecho(void)
  {
 +#ifdef DEBUG
 +	__CTRACE("noecho()\n");
 +#endif
  	/* Check if we need to restart ... */
  	if (_cursesi_screen->endwin)
  		__restartwin();
 @@ -398,6 +421,9 @@
  int
  nl(void)
  {
 +#ifdef DEBUG
 +	__CTRACE("nl()\n");
 +#endif
  	/* Check if we need to restart ... */
  	if (_cursesi_screen->endwin)
  		__restartwin();
 @@ -411,6 +437,7 @@
  	_cursesi_screen->baset.c_iflag |= ICRNL;
  	_cursesi_screen->baset.c_oflag |= ONLCR;

 +	__nl = 1;
  	_cursesi_screen->pfast = _cursesi_screen->rawmode;
  	return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
  			  TCSASOFT | TCSADRAIN : TCSADRAIN,
 @@ -420,6 +447,9 @@
  int
  nonl(void)
  {
 +#ifdef DEBUG
 +	__CTRACE("nonl()\n");
 +#endif
  	/* Check if we need to restart ... */
  	if (_cursesi_screen->endwin)
  		__restartwin();
 @@ -433,6 +463,7 @@
  	_cursesi_screen->baset.c_iflag &= ~ICRNL;
  	_cursesi_screen->baset.c_oflag &= ~ONLCR;

 +	__nl = 0;
  	__pfast = 1;
  	return (tcsetattr(fileno(_cursesi_screen->infd), __tcaction ?
  			  TCSASOFT | TCSADRAIN : TCSADRAIN,
  ---8<---------------------------- Cut here ---------------------------->8---
 -- 
                     My other computer also runs NetBSD
                           http://www.netbsd.org/

From: Julian Coleman <jdc@coris.demon.co.uk>
To: Stephen Borrill <netbsd@precedence.co.uk>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/20834: dialog doesn't receive Return keypresses over telnet
Date: Thu, 3 Apr 2003 12:52:49 +0100

 > Looking through it, except for a bit of extra debugging, it's a very
 > simple patch. I'm not really in a position to test it against -current. It
 > looks like the patch should apply pretty cleanly against 1.6.1, so I'll
 > test it against that if that's OK.

 Yes.  The problem was that the library relied on changing the tty (termios)
 settings to accomplish nl() and nonl().  This doesn't work if EXTPROC is set.
 So, the (simple) fix is to add a flag and do the translation ourselves in
 wgetch().  I added the debug so that I could see when those functions were
 called.

 I don't think there will be any problems applying the changes to the 1.6
 branch.  I'll ask for a pullup but that probably won't make 1.6.1.

 > Any feelings about how long this might be? I might give it a go too. I'd
 > certainly be happy to test it.

 I wasn't planning to start immediately - say the next few weeks or so.  If
 you want to do it, that would be great ;-)

 J

 -- 
                     My other computer also runs NetBSD
                           http://www.netbsd.org/

From: Stephen Borrill <netbsd@precedence.co.uk>
To: Julian Coleman <jdc@coris.demon.co.uk>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/20834: dialog doesn't receive Return keypresses over telnet
Date: Thu, 3 Apr 2003 14:09:39 +0100 (BST)

 On Thu, 3 Apr 2003, Julian Coleman wrote:
 > I don't think there will be any problems applying the changes to the 1.6
 > branch.  I'll ask for a pullup but that probably won't make 1.6.1.

 I don't think so. The release was tagged on the 2nd April. :-)

 > > Any feelings about how long this might be? I might give it a go too. I'd
 > > certainly be happy to test it.
 > 
 > I wasn't planning to start immediately - say the next few weeks or so.  If
 > you want to do it, that would be great ;-)

 It looks like a lot of the work will be assessing all the patches that
 0.6z has.

 -- 
 Stephen



From: Stephen Borrill <netbsd@precedence.co.uk>
To: Julian Coleman <jdc@coris.demon.co.uk>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/20834: dialog doesn't receive Return keypresses over telnet
Date: Thu, 3 Apr 2003 15:36:50 +0100 (BST)

 On Tue, 1 Apr 2003, Julian Coleman wrote:

 > This looks like a bug in the nl()/nonl() handling in the curses wgetch()
 > function.  The following patch fixes it for me.  Could you test it, please?
 [snip]

 I can confirm that this patch works with 1.6.1 (and I'm sure with -current
 too).

 -- 
 Stephen



From: Julian Coleman <jdc@coris.demon.co.uk>
To: Stephen Borrill <netbsd@precedence.co.uk>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/20834: dialog doesn't receive Return keypresses over telnet
Date: Fri, 4 Apr 2003 11:42:46 +0100

 > I don't think so. The release was tagged on the 2nd April. :-)

 Oops!  I knew it was close - I hadn't been following that closely though!

 > It looks like a lot of the work will be assessing all the patches that
 > 0.6z has.

 With any luck, a lot of them will be superflous with 0.9.  The packages that
 depend on dialog (chat/bnc, print/teTeX-bin and print/teTeX2-bin) also need
 checking to make sure that they still work.

 > I can confirm that this patch works with 1.6.1 (and I'm sure with -current
 > too).

 Great!  Thanks for that.  I'll get things checked in today/tomorrow and
 pullups requested.

 J

 -- 
                     My other computer also runs NetBSD
                           http://www.netbsd.org/

From: Julian Coleman <jdc@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: pr/20834 CVS commit: src/lib/libcurses
Date: Sat,  5 Apr 2003 13:07:01 +0300 (EEST)

 Module Name:	src
 Committed By:	jdc
 Date:		Sat Apr  5 10:07:00 UTC 2003

 Modified Files:
 	src/lib/libcurses: curses_private.h getch.c screen.c tty.c

 Log Message:
 Keep the cr->nl translation state in a separate variable, so that we can
 do the translation ourselves (if the tty didn't do it for us).
 Add debugging to track functions that change tty state.

 Fixes PR 20834 by Stephen Borrill.


 To generate a diff of this commit:
 cvs rdiff -r1.29 -r1.30 src/lib/libcurses/curses_private.h
 cvs rdiff -r1.39 -r1.40 src/lib/libcurses/getch.c
 cvs rdiff -r1.12 -r1.13 src/lib/libcurses/screen.c
 cvs rdiff -r1.31 -r1.32 src/lib/libcurses/tty.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


From: Julian Coleman <jdc@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: pr/20834 CVS commit: pkgsrc/misc/dialog
Date: Sat,  5 Apr 2003 13:14:58 +0300 (EEST)

 Module Name:	pkgsrc
 Committed By:	jdc
 Date:		Sat Apr  5 10:14:57 UTC 2003

 Modified Files:
 	pkgsrc/misc/dialog: Makefile

 Log Message:
 Mark NetBSD 1.6 version as imcompatible.
 From PR 20834 by Stephen Borrill.


 To generate a diff of this commit:
 cvs rdiff -r1.13 -r1.14 pkgsrc/misc/dialog/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed 
State-Changed-By: jdc 
State-Changed-When: Sat Apr 5 10:28:46 PST 2003 
State-Changed-Why:  
Changes made and pullup for the 1.6 branch requested. 
>Unformatted:
 	NetBSD 1.6_RC2
 	NetBSD 1.6N (2003-02-10 snapshot)

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.