NetBSD Problem Report #57749

From www@netbsd.org  Mon Dec  4 09:05:25 2023
Return-Path: <www@netbsd.org>
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 21CCC1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  4 Dec 2023 09:05:25 +0000 (UTC)
Message-Id: <20231204090524.3C28D1A9239@mollari.NetBSD.org>
Date: Mon,  4 Dec 2023 09:05:24 +0000 (UTC)
From: syleishere@gmail.com
Reply-To: syleishere@gmail.com
To: gnats-bugs@NetBSD.org
Subject: nano cursor movement problem on NetBSD 10 pkgsrc
X-Send-Pr-Version: www-1.0

>Number:         57749
>Category:       pkg
>Synopsis:       nano cursor movement problem on NetBSD 10 pkgsrc
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 04 09:10:00 +0000 2023
>Last-Modified:  Tue Apr 09 19:25:01 +0000 2024
>Originator:     Dan
>Release:        nano-7.2
>Organization:
>Environment:
netbsd# uname -a
NetBSD netbsd.sunsaturn.com 10.0_RC1 NetBSD 10.0_RC1 (GENERIC) #0: Sun Nov  5 18:30:08 UTC 2023  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
netbsd# 
>Description:
testing nano and cursor does not update movement on existing files, seems maybe like a repeat of:

https://gnats.netbsd.org/37208

>How-To-Repeat:
pkg_add https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/10.0/All/py310-pkginfo-1.9.6.tgz
pkgin install nano

nano /etc/motd
(try to press down arrow key on existing file and does not move)
>Fix:

>Audit-Trail:
From: "Nia Alarie" <nia@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57749 CVS commit: pkgsrc/editors/nano
Date: Sat, 2 Mar 2024 10:33:07 +0000

 Module Name:	pkgsrc
 Committed By:	nia
 Date:		Sat Mar  2 10:33:07 UTC 2024

 Modified Files:
 	pkgsrc/editors/nano: Makefile options.mk

 Log Message:
 nano: force use of ncurses until PR pkg/57749 is resolved


 To generate a diff of this commit:
 cvs rdiff -u -r1.106 -r1.107 pkgsrc/editors/nano/Makefile
 cvs rdiff -u -r1.6 -r1.7 pkgsrc/editors/nano/options.mk

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

From: "Benny Siegert" <bsiegert@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57749 CVS commit: [pkgsrc-2023Q4] pkgsrc/editors/nano
Date: Tue, 5 Mar 2024 14:24:30 +0000

 Module Name:	pkgsrc
 Committed By:	bsiegert
 Date:		Tue Mar  5 14:24:30 UTC 2024

 Modified Files:
 	pkgsrc/editors/nano [pkgsrc-2023Q4]: Makefile options.mk

 Log Message:
 Pullup ticket #6839 - requested by nia
 editors/nano: build fix

 Revisions pulled up:
 - editors/nano/Makefile                                         1.107
 - editors/nano/options.mk                                       1.7

 ---
    Module Name:	pkgsrc
    Committed By:	nia
    Date:		Sat Mar  2 10:33:07 UTC 2024

    Modified Files:
    	pkgsrc/editors/nano: Makefile options.mk

    Log Message:
    nano: force use of ncurses until PR pkg/57749 is resolved


 To generate a diff of this commit:
 cvs rdiff -u -r1.106 -r1.106.8.1 pkgsrc/editors/nano/Makefile
 cvs rdiff -u -r1.6 -r1.6.26.1 pkgsrc/editors/nano/options.mk

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

From: RVP <rvp@SDF.ORG>
To: gnats-bugs@NetBSD.org
Cc: dickey@invisible-island.net
Subject: Re: pkg/57749
Date: Tue, 5 Mar 2024 22:40:15 +0000 (UTC)

 If only the cursor is moved, then a wnoutrefresh() is needed by BSD-curses
 for doupdate() to reflect the new cursor location. Ncurses doesn't seem to
 need that.

 Reproducer:

 ```
 #ifdef DO_NCURSES
 #include <ncursesw/ncurses.h>
 #else
 #include <curses.h>
 #endif

 int main(void) {
  	WINDOW* w;

  	initscr();
  	noecho();
  	raw();

  	w = newwin(0, 0, 0, 0);
  	mvwaddstr(w, 0, 0, "Hello!");

  	wmove(w, 10, 10);
  	doupdate();		/* no wnoutrefresh() needed because text written */
  	(void)wgetch(w);

  	wmove(w, 0, 0);		/* only move cursor now */
  	// wnoutrefresh(w);	/* must refresh on BSD-curses, else cursor doesn't move */
  	doupdate();
  	(void)wgetch(w);

  	delwin(w);
  	endwin();
 }
 ```

 Patch (somebody please upstream):

 ```
 diff -urN nano-7.2.orig/src/winio.c nano-7.2/src/winio.c
 --- nano-7.2.orig/src/winio.c	2023-01-18 08:19:15.000000000 +0000
 +++ nano-7.2/src/winio.c	2024-03-05 22:35:39.461926238 +0000
 @@ -2502,8 +2502,10 @@
   		column -= get_page_start(column);
   	}

 -	if (row < editwinrows)
 +	if (row < editwinrows) {
   		wmove(midwin, row, margin + column);
 +		wnoutrefresh(midwin);
 +	}
   #ifndef NANO_TINY
   	else
   		statusline(ALERT, "Misplaced cursor -- please report a bug");
 ```

 -RVP

From: "Nia Alarie" <nia@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57749 CVS commit: pkgsrc/editors/nano
Date: Fri, 15 Mar 2024 17:35:50 +0000

 Module Name:	pkgsrc
 Committed By:	nia
 Date:		Fri Mar 15 17:35:50 UTC 2024

 Modified Files:
 	pkgsrc/editors/nano: Makefile distinfo options.mk
 Added Files:
 	pkgsrc/editors/nano/patches: patch-src_winio.c

 Log Message:
 nano: NetBSD curses fix; via RVP

 PR pkg/57749


 To generate a diff of this commit:
 cvs rdiff -u -r1.107 -r1.108 pkgsrc/editors/nano/Makefile
 cvs rdiff -u -r1.76 -r1.77 pkgsrc/editors/nano/distinfo
 cvs rdiff -u -r1.7 -r1.8 pkgsrc/editors/nano/options.mk
 cvs rdiff -u -r0 -r1.1 pkgsrc/editors/nano/patches/patch-src_winio.c

 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: pkg/57749: nano cursor movement problem on NetBSD 10 pkgsrc
Date: Mon, 18 Mar 2024 16:23:49 +0300

 On Tue, Mar 05, 2024 at 22:45:01 +0000, RVP wrote:

 > If only the cursor is moved, then a wnoutrefresh() is needed by
 > BSD-curses for doupdate() to reflect the new cursor location.
 > Ncurses doesn't seem to need that.

 Thanks!  I think this analysis is correct.  X/Open Curses, Issue 7
 says for wmove (sorry, PDF only it seems, so no direct link):

   DESCRIPTION
     These functions move the cursor associated with the current or
     specified window to (y, x) relative to the window’s origin. This
     function does not move the terminal’s cursor until the next refresh
     operation.

 wmove by itself doesn't mark the window in need of refresh.  From a
 quick glance through the nano sources, most calls for wmove are
 followed by adding text at the new location and eventually calling
 wrefresh().

 But see e.g. draw_the_promptbar() in src/prompt.c that ends with

     /* Place the cursor at the right spot. */
     wmove(footwin, 0, column - the_page);
     wnoutrefresh(footwin);

 So I think this is a bug in nano that is just masked by the ncurses
 being a bit more eager to track if the update is needed.

 -uwe

From: rvp@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/57749: nano cursor movement problem on NetBSD 10 pkgsrc
Date: Sat, 23 Mar 2024 14:39:39 GMT

 > wmove by itself doesn't mark the window in need of refresh.
 > [...]
 > So I think this is a bug in nano that is just masked by the ncurses
 > being a bit more eager to track if the update is needed.
 >

 Yah. The ncurses wmove() man-page also says the same:

 	This routine does not move the physical cursor of the
 	terminal until refresh(3X) is called.

 but, that's not how it behaves. This is an inconsistency in ncurses.

 -RVP

From: Cameron Berkenpas <cam@neo-zeon.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Subject: Re: pkg/57749
Date: Tue, 9 Apr 2024 10:37:45 -0700

 I'm currently experiencing this as well with nano. Interestingly, not on 
 amd64, but only on aarch64.

 In both cases  (amd64 && aarch64), I've installed the binary packages 
 pkg_add (and both within 24 hours of each other).

 Looking at both package repos I see that amd64:
 nano-7.2nb2.tgz

 Aarch:
 nano-7.2.tgz

 Looks like not all other architectures have the updated package yet.

 Sounds like if I install via pkgsrc, it should address the issue?

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-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.