NetBSD Problem Report #55579

From www@netbsd.org  Sun Aug 16 19:47:17 2020
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 "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B431B1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 16 Aug 2020 19:47:17 +0000 (UTC)
Message-Id: <20200816194716.E23EC1A9246@mollari.NetBSD.org>
Date: Sun, 16 Aug 2020 19:47:16 +0000 (UTC)
From: jnaman806@gmail.com
Reply-To: jnaman806@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [libcurses] inconsistent behaviour of subwindows
X-Send-Pr-Version: www-1.0

>Number:         55579
>Category:       lib
>Synopsis:       [libcurses] inconsistent behaviour of subwindows
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    blymn
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 16 19:50:00 +0000 2020
>Closed-Date:    Sun Nov 13 21:11:57 +0000 2022
>Last-Modified:  Sun Nov 13 21:11:57 +0000 2022
>Originator:     Naman Jain
>Release:        NetBSD 9.0
>Organization:
IIT Kanpur
>Environment:
NetBSD localhost 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
orig <- newwin()
sub <- subwin(orig)

If we make changes to a subwindow(say add string) and do not call wrefresh(sub), the changes should not be reflected when we call wrefresh(orig).

The curses is showing strange behavior, consider a hierarchy of 3 windows; win1, win2, win3 in order. Adding a string in win2, win3 and then refreshing win1 must not reflect changes. These changes can be made possible if sycnok on win2/win3. 
Current behaviour is: changes made to win2 are reflected and those made to win3 are not.
>How-To-Repeat:
#include <curses.h>
#include <locale.h>

int main() {
    setlocale(LC_ALL, "");
    initscr();

    WINDOW *win1 = newwin(6,6,2,5);
    WINDOW *win2 = subwin(win1, 5, 5, 3, 6);
    WINDOW *win3 = subwin(win2, 4, 4, 4, 7);

    waddstr(win2, "aaa");
    waddstr(win3, "bbb");
    wrefresh(win1);

    getch();
    endwin();
    return 0;
}

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: lib-bug-people->blymn
Responsible-Changed-By: blymn@NetBSD.org
Responsible-Changed-When: Fri, 11 Nov 2022 06:32:01 +0000
Responsible-Changed-Why:
I will claim this one.


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
Subject: Re: lib/55579: [libcurses] inconsistent behaviour of subwindows
Date: Sat, 12 Nov 2022 07:56:47 +1030

 On Sun, Aug 16, 2020 at 07:50:00PM +0000, jnaman806@gmail.com wrote:
 > 
 > The curses is showing strange behavior, consider a hierarchy of 3 windows; win1, win2, win3 in order. Adding a string in win2, win3 and then refreshing win1 must not reflect changes. These changes can be made possible if sycnok on win2/win3. 
 > Current behaviour is: changes made to win2 are reflected and those made to win3 are not.
 > 

 After careful reading of susv2 I believe that this is the correct behaviour.  The spec says
 that a refresh of a window will propagate changes from a sub window to the parent which is
 what is being observed.  The syncok call permits changes from a sub window to be propagated
 to all ancestors of the sub window instead of just the parent.

 -- 
 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: blymn@NetBSD.org
State-Changed-When: Sun, 13 Nov 2022 21:11:57 +0000
State-Changed-Why:
Closing this PR, I believe that the behaviour described is correct.


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