NetBSD Problem Report #56467

From kim@tac.gw.fi  Wed Oct 27 10:38:55 2021
Return-Path: <kim@tac.gw.fi>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0E2C71A9239
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 27 Oct 2021 10:38:55 +0000 (UTC)
Message-Id: <20211027103850.77E899418D@rendez-vous.gw.fi>
Date: Wed, 27 Oct 2021 13:38:50 +0300 (EEST)
From: kim@netbsd.org (Kimmo Suominen)
Reply-To:
To: gnats-bugs@NetBSD.org
Subject: sysinst output no longer scrolls correctly
X-Send-Pr-Version: 3.95

>Number:         56467
>Category:       install
>Synopsis:       sysinst output no longer scrolls correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    blymn
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 27 10:40:00 +0000 2021
>Closed-Date:    Tue Oct 10 05:24:14 +0000 2023
>Last-Modified:  Tue Oct 10 05:24:14 +0000 2023
>Originator:     kim@netbsd.org (Kimmo Suominen)
>Release:        NetBSD 9.99.92 (202110262340Z)
>Organization:
>Environment:
System: NetBSD rendez-vous.gw.fi 9.99.92 NetBSD 9.99.92 (GENERIC) #0: Tue Oct 26 23:37:40 UTC 2021 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

	For some time now sysinst output is no longer scrolling
	correctly but instead wrapping to a point higher on the
	screen. This affects the list of successful and failed fixes.

	Here is a screenshot displaying the issue:
	http://www.netbsd.org/~kim/sysinst-2021-10-26.png

>How-To-Repeat:

	Run sysinst to upgrade your system.

>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Wed, 27 Oct 2021 12:43:45 +0200

 It is unclear if this is caused by recent libcurses changes (might be
 an old bug only uncovered now)

 Martin

From: Kimmo Suominen <kim@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Wed, 27 Oct 2021 14:01:27 +0300

 Could also have something to do with BIOS vs. UEFI boot. The system
 where I observed the issue is booting UEFI.

 Here is a screenshot from a 9.2_STABLE upgrade where you can see there
 is no issue:
 http://www.netbsd.org/~kim/sysinst-2021-10-26-9.2_STABLE.png

 Now, whether the "Hit enter to continue" text should be on top of the
 divider or not, that I don't know... :)

 Kind regards,
 + Kimmo

From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Thu, 28 Oct 2021 08:05:01 +0000 (UTC)

 Hi,

 As Martin intuited, this is a curses issue when scrolling on a line > the
 max col. width. The patch below works for me, but, better have the curses
 devs. give it a once over before committing.

 Thanks,
 -RVP

 ---START PATCH---
 --- lib/libcurses/addbytes.c.orig	2021-09-06 07:45:48.000000000 +0000
 +++ lib/libcurses/addbytes.c	2021-10-28 07:41:46.402564363 +0000
 @@ -559,6 +559,7 @@
   				return ERR;
   			__CTRACE(__CTRACE_INPUT,
   			    "_cursesi_addwchar: do a scroll\n");
 +			*x = 0;
   			scroll(win);
   		}
   		newx = win->maxx - 1 + win->ch_off;
 ---END PATCH---

From: RVP <rvp@SDF.ORG>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: install/56467
Date: Fri, 11 Feb 2022 09:53:19 +0000 (UTC)

 Can someone reassign this bug to lib/curses and/or send an
 email to blymn so that he can take a look at the patch in this
 PR? That patch still seems to be needed for scroll to work in
 sysinst. My mails from SDF are rejected by blymn's mail server.

 Thanks,
 -RVP

Responsible-Changed-From-To: install-manager->blymn
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Sun, 03 Sep 2023 12:28:39 +0000
Responsible-Changed-Why:
over to curses wizard


From: Julian Coleman <jdc@coris.org.uk>
To: gnats-bugs@netbsd.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, Kimmo Suominen <kim@netbsd.org>,
	RVP <rvp@sdf.org>
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Tue, 5 Sep 2023 21:50:39 +0200

 Hi,

 >  As Martin intuited, this is a curses issue when scrolling on a line > the
 >  max col. width. The patch below works for me, but, better have the curses
 >  devs. give it a once over before committing.
 >  
 >  Thanks,
 >  -RVP
 >  
 >  ---START PATCH---
 >  --- lib/libcurses/addbytes.c.orig	2021-09-06 07:45:48.000000000 +0000
 >  +++ lib/libcurses/addbytes.c	2021-10-28 07:41:46.402564363 +0000
 >  @@ -559,6 +559,7 @@
 >    				return ERR;
 >    			__CTRACE(__CTRACE_INPUT,
 >    			    "_cursesi_addwchar: do a scroll\n");
 >  +			*x = 0;
 >    			scroll(win);
 >    		}
 >    		newx = win->maxx - 1 + win->ch_off;
 >  ---END PATCH---

 I think this patch is OK - we set win->curx = 0 in scroll().  However, I
 wonder if we should add if (!__NONL), as is done there [*]?

 Regards,

 Julian

 PS.  We could probably remove NONL (and GT) because it doesn't look like
 we're using them, but some other time.

 [*] https://nxr.netbsd.org/xref/src/lib/libcurses/tty.c#129

From: RVP <rvp@SDF.ORG>
To: Julian Coleman <jdc@coris.org.uk>
Cc: gnats-bugs@netbsd.org, install-manager@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org, Kimmo Suominen <kim@netbsd.org>
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Tue, 5 Sep 2023 22:43:19 +0000 (UTC)

 On Tue, 5 Sep 2023, Julian Coleman wrote:

 > I think this patch is OK - we set win->curx = 0 in scroll().  However, I
 > wonder if we should add if (!__NONL), as is done there [*]?
 >
 > Regards,
 >
 > Julian
 >
 > PS.  We could probably remove NONL (and GT) because it doesn't look like
 > we're using them, but some other time.
 >
 > [*] https://nxr.netbsd.org/xref/src/lib/libcurses/tty.c#129
 >

 Ah, I've lost all context for this, but, certainly there's an issue a few
 lines above that:

 https://nxr.netbsd.org/xref/src/lib/libcurses/tty.c#116

 It should be `screen->outfd' as per the comment just above.

 -RVP

From: Julian Coleman <jdc@coris.org.uk>
To: gnats-bugs@netbsd.org
Cc: blymn@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
	Kimmo Suominen <kim@netbsd.org>, RVP <rvp@sdf.org>
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Fri, 8 Sep 2023 13:47:56 +0200

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

 Hi,

 >  > I think this patch is OK - we set win->curx = 0 in scroll().  However, I
 >  > wonder if we should add if (!__NONL), as is done there [*]?

 >  Ah, I've lost all context for this, but, certainly there's an issue a few
 >  lines above that:
 >  
 >  https://nxr.netbsd.org/xref/src/lib/libcurses/tty.c#116
 >  
 >  It should be `screen->outfd' as per the comment just above.

 Good point!  Something like the attached should be OK.

 Regards,

 Julian

 --YYpKTFD0O9xRP6OX
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="pr56467-libcurses.patch"

 Index: src/lib/libcurses/addbytes.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libcurses/addbytes.c,v
 retrieving revision 1.68
 diff -u -r1.68 addbytes.c
 --- src/lib/libcurses/addbytes.c	20 Dec 2022 04:57:01 -0000	1.68
 +++ src/lib/libcurses/addbytes.c	6 Sep 2023 20:31:12 -0000
 @@ -585,6 +585,8 @@
  			__CTRACE(__CTRACE_INPUT,
  			    "_cursesi_addwchar: do a scroll\n");
  			scroll(win);
 +			if (!__NONL)
 +				*x = 0;
  		}
  		newx = win->maxx - 1 + win->ch_off;
  		if (newx > *(*lnp)->lastchp)
 Index: src/lib/libcurses/tty.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libcurses/tty.c,v
 retrieving revision 1.49
 diff -u -r1.49 tty.c
 --- src/lib/libcurses/tty.c	6 Sep 2021 07:03:50 -0000	1.49
 +++ src/lib/libcurses/tty.c	6 Sep 2023 20:31:12 -0000
 @@ -113,7 +113,7 @@

  	if (tcgetattr(fileno(screen->infd), &screen->orig_termios)) {
  		/* if the input fd is not a tty try the output */
 -		if (tcgetattr(fileno(screen->infd), &screen->orig_termios)) {
 +		if (tcgetattr(fileno(screen->outfd), &screen->orig_termios)) {
  			/* not a tty ... we will disable tty related stuff */
  			screen->notty = TRUE;
  			__GT = 0;

 --YYpKTFD0O9xRP6OX--

From: Brett Lymn <blymn@internode.on.net>
To: gnats-bugs@netbsd.org
Cc: blymn@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        Kimmo Suominen <kim@netbsd.org>
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Tue, 12 Sep 2023 07:58:57 +0930

 On Fri, Sep 08, 2023 at 11:50:01AM +0000, Julian Coleman wrote:
 >  >  
 >  >  It should be `screen->outfd' as per the comment just above.
 >  
 >  Good point!  Something like the attached should be OK.
 >  

 If we do that then we should apply the same logic a few lines later too  where both *x and
 sx are set to 0

 -- 
 Brett Lymn
 --
 Sent from my NetBSD device.

 "We are were wolves",
 "You mean werewolves?",
 "No we were wolves, now we are something else entirely",
 "Oh"

From: Brett Lymn <blymn@internode.on.net>
To: gnats-bugs@netbsd.org
Cc: blymn@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        Kimmo Suominen <kim@netbsd.org>
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Thu, 5 Oct 2023 16:47:17 +1030

 I have just committed a slightly modified version of the fix proposed
 by RVP based on Julian's comments.  Please test.

 -- 
 Brett Lymn
 --
 Sent from my NetBSD device.

 "We are were wolves",
 "You mean werewolves?",
 "No we were wolves, now we are something else entirely",
 "Oh"

From: Kimmo Suominen <kim@netbsd.org>
To: Brett Lymn <blymn@internode.on.net>
Cc: gnats-bugs@netbsd.org, blymn@netbsd.org, gnats-admin@netbsd.org, 
	netbsd-bugs@netbsd.org
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Sat, 7 Oct 2023 08:41:53 +0300

 I've tested by running sysinst from NetBSD 10.99.10 (202310061820Z)
 and the screen output looks good now.

 https://www.netbsd.org/~kim/sysinst-2023-10-06-10.99.10.png

 Thanks,
 + Kimmo

From: Kimmo Suominen <kim@netbsd.org>
To: blymn@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Sat, 7 Oct 2023 08:55:41 +0300

 Are these the commits that should be pulled up to NetBSD 10?

 http://mail-index.netbsd.org/source-changes/2023/10/05/msg147877.html
 http://mail-index.netbsd.org/source-changes/2023/10/05/msg147878.html

 Cheers,
 + Kimmo

From: RVP <rvp@SDF.ORG>
To: Kimmo Suominen <kim@netbsd.org>
Cc: blymn@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Sat, 7 Oct 2023 07:59:35 +0000 (UTC)

 On Sat, 7 Oct 2023, Kimmo Suominen wrote:

 > Are these the commits that should be pulled up to NetBSD 10?
 >
 > http://mail-index.netbsd.org/source-changes/2023/10/05/msg147877.html
 > http://mail-index.netbsd.org/source-changes/2023/10/05/msg147878.html
 >

 The 2nd hunk in Julian's patch should go in as well:

 https://mail-index.netbsd.org/netbsd-bugs/2023/09/08/msg079696.html

 -RVP

From: Brett Lymn <blymn@internode.on.net>
To: Kimmo Suominen <kim@netbsd.org>
Cc: blymn@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        gnats-bugs@netbsd.org
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Tue, 10 Oct 2023 07:46:04 +1030

 On Sat, Oct 07, 2023 at 08:55:41AM +0300, Kimmo Suominen wrote:
 > Are these the commits that should be pulled up to NetBSD 10?
 > 
 > http://mail-index.netbsd.org/source-changes/2023/10/05/msg147877.html
 > http://mail-index.netbsd.org/source-changes/2023/10/05/msg147878.html
 > 

 Yes, they should be pulled up to NetBSD 10.

 -- 
 Brett Lymn
 --
 Sent from my NetBSD device.

 "We are were wolves",
 "You mean werewolves?",
 "No we were wolves, now we are something else entirely",
 "Oh"

From: Brett Lymn <blymn@internode.on.net>
To: RVP <rvp@SDF.ORG>
Cc: Kimmo Suominen <kim@netbsd.org>, blymn@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: install/56467: sysinst output no longer scrolls correctly
Date: Tue, 10 Oct 2023 07:48:47 +1030

 On Sat, Oct 07, 2023 at 07:59:35AM +0000, RVP wrote:
 > 
 > The 2nd hunk in Julian's patch should go in as well:
 > 
 > https://mail-index.netbsd.org/netbsd-bugs/2023/09/08/msg079696.html
 > 

 I have just committed that one too, I didn't put it into the PR commit
 because it really is unrelated and an unusual corner case since to
 actually notice it you would have to redirect stdin but have stdout
 still going to a terminal for the curses application.

 Thanks Julian for the pick up.

 -- 
 Brett Lymn
 --
 Sent from my NetBSD device.

 "We are were wolves",
 "You mean werewolves?",
 "No we were wolves, now we are something else entirely",
 "Oh"

State-Changed-From-To: open->closed
State-Changed-By: kim@NetBSD.org
State-Changed-When: Tue, 10 Oct 2023 05:24:14 +0000
State-Changed-Why:
Fixed and pull up request sent.
http://releng.netbsd.org/cgi-bin/req-10.cgi?show=402


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.