NetBSD Problem Report #51819

From www@NetBSD.org  Wed Jan 11 01:13:37 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A6E237A1B1
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 11 Jan 2017 01:13:37 +0000 (UTC)
Message-Id: <20170111011336.4FB937A2A3@mollari.NetBSD.org>
Date: Wed, 11 Jan 2017 01:13:36 +0000 (UTC)
From: uwe@NetBSD.org
Reply-To: uwe@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: curses vs. news/tin display problems
X-Send-Pr-Version: www-1.0

>Number:         51819
>Category:       lib
>Synopsis:       curses vs. news/tin display problems
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 11 01:15:00 +0000 2017
>Closed-Date:    Fri Feb 10 06:27:44 +0000 2017
>Last-Modified:  Fri Feb 10 06:30:01 +0000 2017
>Originator:     Valery Ushakov
>Release:        NetBSD-6.1
>Organization:
>Environment:
NetBSD pony 6.1_STABLE NetBSD 6.1_STABLE (GENERIC) #13: Thu May 19 03:06:28 MSK 2016  root@:/export/netbsd/cvs/src-release-6/sys/arch/macppc/compile/GENERIC macppc 
>Description:
I see this on my NetBSD 6.1 macppc and I also did a quick test on
NetBSD 7.0.1 i386.  I haven't tried current.

news/tin package is built with curses support by default

  PKG_OPTIONS_GROUP.display=     curses ncurses ncursesw
  PKG_SUGGESTED_OPTIONS=         curses inet6

Unfortunately when built with NetBSD curses (as suggested), it has
display problems.  I haven't tried building the package with ncurses,
but I assume it should work, or someone would have noticed that :).

See below for details.

>How-To-Repeat:
Install news/tin (a binary package will do).  Use it to read news,
e.g. via gmane nntp interface at news.gmane.org.  This mostly works,
but open any article and use arrows down/up to scroll the article a
line at a time.  Observe the display garbled.  I see this both under
screen and wsvt25.

When you scroll down, the ghost of the "--More--" prompt scrolls up.
E.g. you can see something like this at the bottom of the screen:

----8<--------8<----
standards                   1        9       23       33      2m 21d 23:54:08   
toolchain                   8       64       55      127      3m 15d 21:55:17   
xsrc                        4       25       21       50         25d 22:46:599] 
TOTAL                     548     2590     2191     5329  --More--(93%) [55/59] 
                                                          --More--(94%) [56/59] 
                                                          --More--(96%) [57/59] 
                                                          --More--(98%) [58/59] 
                                                            -- Next response --
----8<--------8<----


When you scroll up, the article header scrolls down and disappears
instead of staying where it is.

>Fix:
The workaround I've been using for ages is to add "nocurses" option to

  PKG_OPTIONS_GROUP.display=     nocurses curses ncurses ncursesw

and use that option to build the package.  It will cause configure to
be run without --with-screen=... argument and tin will fall back to
raw termcap/terminfo display code that works.

>Release-Note:

>Audit-Trail:

From: "Roy Marples" <roy@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51819 CVS commit: pkgsrc/news/tin
Date: Wed, 11 Jan 2017 02:15:56 +0000

 Module Name:	pkgsrc
 Committed By:	roy
 Date:		Wed Jan 11 02:15:56 UTC 2017

 Modified Files:
 	pkgsrc/news/tin: Makefile options.mk

 Log Message:
 Allow tin to build using termcap instead of curses.
 Workaround for PR plg/51819.


 To generate a diff of this commit:
 cvs rdiff -u -r1.71 -r1.72 pkgsrc/news/tin/Makefile
 cvs rdiff -u -r1.16 -r1.17 pkgsrc/news/tin/options.mk

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

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/51819: curses vs. news/tin display problems
Date: Wed, 11 Jan 2017 18:27:37 +0300

 The problem seems to be that on NetBSD scrl(3)

      If a scrolling region has been set with the setscrreg() or wsetscrreg()
      functions and the current cursor position is inside the scrolling region,
      then only the area inside the scrolling region is scrolled.

 and otherwise the whole window is scrolled.

 ncurses always scrolls the scroll region, regardless of the current
 cursor position.

 SUSv2 X/Open curses scrl(3) says that

   The interaction of these functions with setscrreg() is currently
   unspecified.

 -uwe

From: Brett Lymn <blymn@internode.on.net>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        uwe@NetBSD.org
Subject: Re: lib/51819: curses vs. news/tin display problems
Date: Thu, 12 Jan 2017 07:51:22 +1030

 --vtzGhvizbBRQ85DL
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 On Wed, Jan 11, 2017 at 03:30:01PM +0000, Valery Ushakov wrote:
 >  
 >    The interaction of these functions with setscrreg() is currently
 >    unspecified.
 >  

 Try the attached patch, I have removed the check where the cursor is and
 just scroll the requested window.

 -- 
 Brett Lymn
 Let go, or be dragged - Zen proverb.

 --vtzGhvizbBRQ85DL
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="scroll.diff"

 Index: scroll.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libcurses/scroll.c,v
 retrieving revision 1.23
 diff -u -r1.23 scroll.c
 --- scroll.c	6 Jan 2017 13:53:18 -0000	1.23
 +++ scroll.c	11 Jan 2017 21:20:03 -0000
 @@ -100,12 +100,7 @@
  #ifdef DEBUG
  	__CTRACE(__CTRACE_WINDOW, "wscrl: y=%d\n", oy);
  #endif
 -	if (oy < win->scr_t || oy > win->scr_b)
 -		/* Outside scrolling region */
 -		wmove(win, 0, 0);
 -	else
 -		/* Inside scrolling region */
 -		wmove(win, win->scr_t, 0);
 +	wmove(win, win->scr_t, 0);
  	winsdelln(win, 0 - nlines);
  	wmove(win, oy, ox);


 --vtzGhvizbBRQ85DL--

From: Brett Lymn <blymn@internode.on.net>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        uwe@NetBSD.org
Subject: Re: lib/51819: curses vs. news/tin display problems
Date: Thu, 12 Jan 2017 07:40:48 +1030

 On Wed, Jan 11, 2017 at 03:30:01PM +0000, Valery Ushakov wrote:
 > 
 >  The problem seems to be that on NetBSD scrl(3)
 >  
 >       If a scrolling region has been set with the setscrreg() or wsetscrreg()
 >       functions and the current cursor position is inside the scrolling region,
 >       then only the area inside the scrolling region is scrolled.
 >  
 >  and otherwise the whole window is scrolled.
 >  
 >  ncurses always scrolls the scroll region, regardless of the current
 >  cursor position.
 >  
 >  SUSv2 X/Open curses scrl(3) says that
 >  
 >    The interaction of these functions with setscrreg() is currently
 >    unspecified.
 >  

 In that case we probably should look at making NetBSD curses follow
 ncurses to reduce surprises...

 -- 
 Brett Lymn
 Let go, or be dragged - Zen proverb.

State-Changed-From-To: open->closed
State-Changed-By: blymn@NetBSD.org
State-Changed-When: Fri, 10 Feb 2017 06:27:44 +0000
State-Changed-Why:
fixed bug in curses that was causing the display corruption.


From: "Brett Lymn" <blymn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51819 CVS commit: src/lib/libcurses
Date: Fri, 10 Feb 2017 06:25:28 +0000

 Module Name:	src
 Committed By:	blymn
 Date:		Fri Feb 10 06:25:28 UTC 2017

 Modified Files:
 	src/lib/libcurses: scroll.c

 Log Message:
 Remove checks for cursor being in scrolling region, ncurses doesn't
 do checking, rather just scrolls the scrolling region so we shall
 follow suit.  SUSv2 says what is happens when scrl is called with the
 cursor outside the scrolling is undefined so we should match ncurses.
 This fixes PR#51819 without forcing tin to use terminfo directly.


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 src/lib/libcurses/scroll.c

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.