NetBSD Problem Report #53733

From www@NetBSD.org  Sun Nov 18 23:53:39 2018
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 9B1C87A10D
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 18 Nov 2018 23:53:39 +0000 (UTC)
Message-Id: <20181118235338.9C3B27A1D7@mollari.NetBSD.org>
Date: Sun, 18 Nov 2018 23:53:38 +0000 (UTC)
From: uwe@NetBSD.org
Reply-To: uwe@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: curses wbkgrnd() doesn't apply new background
X-Send-Pr-Version: www-1.0

>Number:         53733
>Category:       lib
>Synopsis:       curses wbkgrnd() doesn't apply new background
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 18 23:55:00 +0000 2018
>Closed-Date:    Mon Apr 25 22:02:29 +0000 2022
>Last-Modified:  Mon Apr 25 22:02:29 +0000 2022
>Originator:     Valery Ushakov
>Release:        NetBSD 8.99.19
>Organization:
>Environment:
>Description:
wbkgrnd() does wbkgrndset() and also should apply the new background
to existing contents of the window.  Ours doesn't.

>How-To-Repeat:
#define NCURSES_WIDECHAR 1      /* when compiling against ncurses */
#include <curses.h>

#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>


int
main()
{
    WINDOW *scrw = initscr();
    if (scrw == NULL)
        errx(EXIT_FAILURE, "initscr failed");

    mvaddstr(0, 0, "Hello world\n");
    refresh();
    sleep(1);

    cchar_t bg;
    wgetbkgrnd(stdscr, &bg);

    wchar_t bg_wch;
    attr_t bg_attr;
    short bg_color_pair;
    getcchar(&bg, &bg_wch, &bg_attr, &bg_color_pair, NULL);

    bg_wch = '-';
    setcchar(&bg, &bg_wch, bg_attr, bg_color_pair, NULL);

    bkgrnd(&bg);
    refresh();
    sleep(1);

    endwin();
    return EXIT_SUCCESS;
}

$ cc -o bkgrnd bkgrnd.c -lcurses
$ ./bkgrnd

Compare to devel/ncursesw

$ cc -o bkgrnd -I/usr/pkg/include/ncursesw -I/usr/pkg/include bkgrnd.c -L/usr/pkg/lib -Wl,--rpath=/usr/pkg/lib -lncursesw
$ ./bkgrnd


Ncurses fills the screen with minus signs as expected.


Note that old wbkgd() function does the right thing.

>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: blymn@NetBSD.org
State-Changed-When: Mon, 25 Apr 2022 22:02:29 +0000
State-Changed-Why:
Fixed in another PR.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.