NetBSD Problem Report #58090

From www@netbsd.org  Fri Mar 29 23:31:09 2024
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 619251A923B
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 29 Mar 2024 23:31:09 +0000 (UTC)
Message-Id: <20240329233107.F0E7B1A923C@mollari.NetBSD.org>
Date: Fri, 29 Mar 2024 23:31:07 +0000 (UTC)
From: rwhitlock22@gmail.com
Reply-To: rwhitlock22@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Ctrl-Z, fg makes blinking cursor in vi
X-Send-Pr-Version: www-1.0

>Number:         58090
>Category:       bin
>Synopsis:       Ctrl-Z, fg makes blinking cursor in vi
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 29 23:35:00 +0000 2024
>Last-Modified:  Wed Jul 24 10:00:02 +0000 2024
>Originator:     Robert Whitlock
>Release:        NetBSD 10.0 RC6
>Organization:
>Environment:
NetBSD thinkpad 10.0_RC6 NetBSD 10.0_RC6 (THINKPAD) #0: Tue Mar 26 18:20:30 EDT 2024  rob@thinkpad:/usr/src_netbsd-10/arch/amd64/compile/THINKPAD amd64
>Description:
If you suspend vi with Control-Z and then resume it with fg, the
cursor blinks whereas before it was suspended it did not.
>How-To-Repeat:
Open an xterm
Run vi
Notice the cursor is not blinking
Type Ctrl-Z to suspend vi
Type fg to resume vi
Notice that the cursor is blinking

Note that this does not happen in a VT.
>Fix:
I would guess that either some terminfo settings are incorrect or vi
doesn't use them correctly.

>Release-Note:

>Audit-Trail:
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/58090: Ctrl-Z, fg makes blinking cursor in vi
Date: Sat, 30 Mar 2024 04:27:20 +0300

 A minimized reproducer distilled from cl_suspend() is

 #include <curses.h>

 int
 main(void)
 {
     initscr();
     getch();
     endwin();
     refresh(); // <- makes it blink
     getch();
     endwin();
     return 0;
 }


 -uwe

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/58090: Ctrl-Z, fg makes blinking cursor in vi
Date: Sat, 30 Mar 2024 04:36:05 +0300

 The bug is in curses and it's that we init

     new_screen->old_mode = 2;

 Where "old_mode" is a bit cryptic, but it means the old cursor mode:

     void
     __restore_cursor_vis(void)
     {
             curs_set(_cursesi_screen->old_mode);
     }


 -uwe

From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc: Valery Ushakov <uwe@stderr.spb.ru>,
        Tom Dickey <dickey@invisible-island.net>
Subject: Re: bin/58090: Ctrl-Z, fg makes blinking cursor in vi
Date: Wed, 22 May 2024 22:57:56 +0000 (UTC)

 On Sat, 30 Mar 2024, Valery Ushakov wrote:

 > The bug is in curses and it's that we init
 >
 >     new_screen->old_mode = 2;
 >
 > Where "old_mode" is a bit cryptic, but it means the old cursor mode:
 >
 >     void
 >     __restore_cursor_vis(void)
 >     {
 >             curs_set(_cursesi_screen->old_mode);
 >     }
 >
 >

 Yeah. There's no "correct" default setting for this because you
 can't (as far as I know) query the terminal to find out what the
 terminal's current cursor visibility is. So, curses has to assume
 some default.

 I talked to Tom Dickey about this some time back and he says the
 Solaris curses also sets this to 1. Maybe BSD curses should do too?

 -RVP

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: RVP <rvp@SDF.ORG>, Tom Dickey <dickey@invisible-island.net>,
	Brett Lymn <blymn@internode.on.net>
Subject: Re: bin/58090: Ctrl-Z, fg makes blinking cursor in vi
Date: Thu, 23 May 2024 02:32:41 +0300

 On Wed, May 22, 2024 at 22:57:56 +0000, RVP wrote:

 > Solaris curses also sets this to 1. Maybe BSD curses should do too?

 Oh, I wanted to ask Brett if he's ok with that, but this has
 completely fell through cracks...  Thanks for the reminder.

 Yeah, I have no idea where that 2 came from, 1 looks like a much more
 sane choice.

 -uwe

From: Brett Lymn <blymn@internode.on.net>
To: Valery Ushakov <uwe@stderr.spb.ru>
Cc: gnats-bugs@netbsd.org, RVP <rvp@SDF.ORG>,
        Tom Dickey <dickey@invisible-island.net>
Subject: Re: bin/58090: Ctrl-Z, fg makes blinking cursor in vi
Date: Fri, 24 May 2024 16:42:10 +0930

 On Thu, May 23, 2024 at 02:32:41AM +0300, Valery Ushakov wrote:
 > 
 > Yeah, I have no idea where that 2 came from, 1 looks like a much more
 > sane choice.
 > 

 I have no idea where 2 came from either but it looks like vi mustn't
 ever set the cursor mode using curs_set otherwise the state would have
 been saved.  So, yes, setting it the initial value to 1 (a.k.a normal)
 would be appropriate instead of the current 2 (a.k.a high visibility)

 -- 
 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: "Valery Ushakov" <uwe@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58090 CVS commit: src/lib/libcurses
Date: Mon, 27 May 2024 14:30:43 +0000

 Module Name:	src
 Committed By:	uwe
 Date:		Mon May 27 14:30:43 UTC 2024

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

 Log Message:
 curses: init old_mode to 1 (normal visible cursor)

 PR bin/58090: Ctrl-Z, fg makes blinking cursor in vi
 ok blymn@


 To generate a diff of this commit:
 cvs rdiff -u -r1.38 -r1.39 src/lib/libcurses/screen.c

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

From: "Valery Ushakov" <uwe@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58090 CVS commit: src/tests/lib/libcurses/tests
Date: Wed, 5 Jun 2024 16:09:59 +0000

 Module Name:	src
 Committed By:	uwe
 Date:		Wed Jun  5 16:09:59 UTC 2024

 Modified Files:
 	src/tests/lib/libcurses/tests: curs_set

 Log Message:
 adjust initial cursor state to reflect reality

 Missed in PR bin/58090
 Fixes PR lib/58313


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/tests/curs_set

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58090 CVS commit: [netbsd-10] src
Date: Wed, 24 Jul 2024 09:57:13 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Jul 24 09:57:13 UTC 2024

 Modified Files:
 	src/lib/libcurses [netbsd-10]: screen.c
 	src/tests/lib/libcurses/tests [netbsd-10]: curs_set

 Log Message:
 Pull up following revision(s) (requested by uwe in ticket #768):

 	tests/lib/libcurses/tests/curs_set: revision 1.2
 	lib/libcurses/screen.c: revision 1.39

 curses: init old_mode to 1 (normal visible cursor)
 PR bin/58090: Ctrl-Z, fg makes blinking cursor in vi
 ok blymn@

 adjust initial cursor state to reflect reality
 Missed in PR bin/58090

 Fixes PR lib/58313


 To generate a diff of this commit:
 cvs rdiff -u -r1.37 -r1.37.2.1 src/lib/libcurses/screen.c
 cvs rdiff -u -r1.1 -r1.1.54.1 src/tests/lib/libcurses/tests/curs_set

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