NetBSD Problem Report #51374

From paul@whooppee.com  Fri Jul 29 09:23:37 2016
Return-Path: <paul@whooppee.com>
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 D5FCD7A271
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 29 Jul 2016 09:23:37 +0000 (UTC)
Message-Id: <20160729092334.ED33416E60@pokey.whooppee.com>
Date: Fri, 29 Jul 2016 17:23:34 +0800 (PHT)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: sysinstall leaves serial console in non-scrolling state
X-Send-Pr-Version: 3.95

>Number:         51374
>Category:       install
>Synopsis:       sysinstall leaves serial console in non-scrolling state
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 29 09:25:00 +0000 2016
>Last-Modified:  Sat Jul 30 11:05:01 +0000 2016
>Originator:     Paul Goyette
>Release:        NetBSD 7.99.33
>Organization:
+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+
>Environment:


System: NetBSD pokey.whooppee.com 7.99.33 NetBSD 7.99.33 (POKEY 2016-07-04 08:34:20) #0: Mon Jul 4 20:24:24 PHT 2016 paul@pokey.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/POKEY amd64
Architecture: x86_64
Machine: amd64
>Description:
	When sysinstall starts up, it appears to establish a "scroll
	region" on lines 1 through 24.  If you're running sysinstall
	within a qemu emulator session, and your terminal session is
	"tall" (ie, has more than 24 lines;  mine has 36), then when
	sysinstall exits, it leaves the scroll region intact.  And
	the cursor will eventually move beyond the end of the scroll
	region.  When it reaches the last line on the host's window,
	it won't scroll, and from that point on everything happens on
	the bottom line (until you reset the session).

>How-To-Repeat:
	See above.

>Fix:
	Sysinstall should remove the scroll region whenever it is going
	to exit from its "heavily controlled display" mode.  Thus it
	should do so at exit (before shutting down the newly-installed
	system) as well as any time the user requests "exit to shell".


>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: install/51374: sysinstall leaves serial console in non-scrolling state
Date: Fri, 29 Jul 2016 11:29:50 +0200

 On Fri, Jul 29, 2016 at 09:25:00AM +0000, paul@whooppee.com wrote:
 > 	Sysinstall should remove the scroll region whenever it is going
 > 	to exit from its "heavily controlled display" mode.  Thus it
 > 	should do so at exit (before shutting down the newly-installed
 > 	system) as well as any time the user requests "exit to shell".

 Isn't this a curses problem?

 Martin

From: Julian Coleman <jdc@coris.org.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: install/51374: sysinstall leaves serial console in non-scrolling state
Date: Fri, 29 Jul 2016 16:30:03 +0100

 Hi,

 >  > 	Sysinstall should remove the scroll region whenever it is going
 >  > 	to exit from its "heavily controlled display" mode.  Thus it
 >  > 	should do so at exit (before shutting down the newly-installed
 >  > 	system) as well as any time the user requests "exit to shell".
 >  
 >  Isn't this a curses problem?

 It does sound like one, but see below.

 For vtxxx-based terminals (including Xterm), it's necessary to reset the
 scrolling region to the size of the screen to avoid strange effects like
 this.  Our curses code does do this - see refresh.c lines 1715 onward:

   tputs(tiparm(change_scroll_region, top, bot),
       0, __cputchar);
     ...
   tputs(tiparm(change_scroll_region,
       0, (int) __virtscr->maxy - 1), 0, __cputchar);

 where we initially set a smaller scrolling region (from "top" to "bot")
 then restore it (from "0" to __virtscr->maxy - 1).  There isn't a code
 path were we don't restore it.

 > 	When sysinstall starts up, it appears to establish a "scroll
 > 	region" on lines 1 through 24.  If you're running sysinstall
 > 	within a qemu emulator session, and your terminal session is
 > 	"tall" (ie, has more than 24 lines;  mine has 36), then when
 > 	sysinstall exits, it leaves the scroll region intact.  

 In the above, "__virtscr->maxy - 1" should be equal to the height of the
 terminal minus 1 (we count internally from row 0).  I would guess that
 something goes wrong when we try and determine the screen size, and we
 end up guessing 24 lines.  Thus, when we reset the scrolling region to
 the size of the screen, we actually set it to the wrong size.

 Does sysinst only use the first 24 rows of the screen?

 It looks like some terminals accept an empty scrolling region to reset it
 to the default (row 1 to max row).  We might be able to use that instead
 of the explicit values.  However, I'm not sure if every terminal supports
 the empty scrolling region (maybe this no longer matters).  Also, I see
 that ncurses always sends explicit values when resetting.

 Regards,

 J

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

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: install/51374: sysinstall leaves serial console in non-scrolling state
Date: Sat, 30 Jul 2016 13:02:46 +0200

 On Fri, Jul 29, 2016 at 03:35:01PM +0000, Julian Coleman wrote:
 >  Does sysinst only use the first 24 rows of the screen?

 Doesn't look that way:

 (gdb) up
 #2  0x00007f7ff781a2d5 in makech (wy=15)
     at /usr/src/lib/libcurses/refresh.c:1053
 1053                                    __set_color(curscr, nsp->attr & __COLOR);
 (gdb) p *__virtscr
 $3 = {nextp = 0x7f7ff7b211c0, orig = 0x0, begy = 0, begx = 0, cury = 21, 
   curx = 32, maxy = 42, maxx = 111, reqy = 0, reqx = 0, ch_off = 0, 
   alines = 0x7f7ff7b13570, lspace = 0x7f7ff7b05800, wspace = 0x7f7ff7b4a000, 
   flags = 327709, delay = -1, wattr = 0 L'\000\000\000\000', 
   bch = 32 L' \000\000\000', battr = 0 L'\000\000\000\000', scr_t = 0, 
   scr_b = 41, screen = 0x7f7ff7b0e000, pbegy = 0, pbegx = 0, sbegy = 0, 
   sbegx = 0, smaxy = 0, smaxx = 0, dery = 0, derx = 0, bnsp = 0x0}


 Martin

>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.