NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/58444: curses: wbkg regression



>Number:         58444
>Category:       bin
>Synopsis:       curses: wbkg regression
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 19 13:55:00 +0000 2024
>Originator:     Valery Ushakov
>Release:        NetBSD 10
>Organization:
>Environment:
NetBSD snips 10.0_STABLE NetBSD 10.0_STABLE (GENERIC) #0: Mon Jul  8 16:08:11 MSK 2024  uwe@majava:/home/uwe/work/netbsd/cvs/src-release-10/sys/arch/macppc/compile/GENERIC macppc
>Description:
lib/libcurses/background.c
revision 1.31
date: 2022-05-03 10:25:34 +0300;  author: blymn;  state: Exp;  lines: +15 -13;  commitid: pj0Gxm3JnXF80ACD;
[...]
 * Fix bug introduced when wbkgrndset was fixed, we cannot blindly
   replace any instance of the old background character with the new one
   because some of those characters were put there by the application
   leading to display corruption.  So flag characters as background when
   they are erased and only update the flagged characters when setting
   the background.

I think this change is incorrect.  This is not how I read the XCurses
spec and this is not what ncurses does.  Consider:

    mvaddstr(5, 0, "hel lo");
    bkgd('~');
    mvaddstr(6, 0, "HEL LO");

which renders as

   |~~~~~~~~...
   |hel~lo~~...
   |HEL~LO~~...
   |~~~~~~~~...

with ncurses, but as 

   |~~~~~~~~...
   |hel lo~~...
   |HEL LO~~...
   |~~~~~~~~...

on NetBSD.

The first bug is that the background character in "hel lo"  is not
replaced, the second is that the space in "HEL LO" is not rendered
as the background character.

X/Open Curses, Issue 7 says:

  3.4.4 Rendition of Characters Placed into a Window

  When the application adds or inserts characters into a window, the
  effect is as follows:
  [...]

  If the character is the <space> character, then the window receives:

  * The background character

  * The color that the application specifies; or the window color, if
    the application does not specify a color


So the whole idea of distinguihing a "real" background character vs.
a character explicitly added by the application that happens to be
background character is self-contradictory.

>How-To-Repeat:
#include <curses.h>
#include <unistd.h>

int
main()
{
    initscr();

    mvaddstr(5, 0, "hel lo");

    refresh();
    sleep(1);

    bkgd('~');
    mvaddstr(6, 0, "HEL LO");

    refresh();
    sleep(2);

    endwin();
    return 0;
}

>Fix:



Home | Main Index | Thread Index | Old Index