NetBSD Problem Report #46049

From www@NetBSD.org  Sun Feb 19 02:12:25 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 74D4D63DACD
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 19 Feb 2012 02:12:25 +0000 (UTC)
Message-Id: <20120219021224.7070263D725@www.NetBSD.org>
Date: Sun, 19 Feb 2012 02:12:24 +0000 (UTC)
From: tbvdm@xs4all.nl
Reply-To: tbvdm@xs4all.nl
To: gnats-bugs@NetBSD.org
Subject: clrtobot() and clrtoeol() do not set background attributes
X-Send-Pr-Version: www-1.0

>Number:         46049
>Category:       lib
>Synopsis:       clrtobot() and clrtoeol() do not set background attributes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 19 02:15:00 +0000 2012
>Closed-Date:    Mon Feb 20 21:43:25 +0000 2012
>Last-Modified:  Sat Mar 17 17:55:01 +0000 2012
>Originator:     Tim van der Molen
>Release:        NetBSD 5.1
>Organization:
>Environment:
NetBSD lambda.kariliq.nl 5.1 NetBSD 5.1 (GENERIC) #0: Sun Nov  7 14:39:56 UTC 2010  builds@b6.netbsd.org:/home/builds/ab/netbsd-5-1-RELEASE/i386/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/i386/compile/GENERIC i386
>Description:
The clrtobot() and clrtoeol() functions do not apply the background attributes (as set by bkgdset()) to the characters they clear.

The below program, for example, only prints the word "hello" in reverse video instead of the whole line.

#include <curses.h>

int
main(void)
{
	initscr();
	bkgdset(A_REVERSE);
	addstr("hello");
	clrtoeol();
	refresh();
	getch();
	endwin();
	return 0;
}
>How-To-Repeat:
See the example program in the full description.
>Fix:
The following diff (against -current) fixes this problem. It is based on a similar fix to src/lib/libcurses/erase.c r1.25.

diff -pru src/lib/libcurses.orig/clrtobot.c src/lib/libcurses/clrtobot.c
--- src/lib/libcurses.orig/clrtobot.c	Thu Jul 23 05:01:50 2009
+++ src/lib/libcurses/clrtobot.c	Sat Feb 18 20:12:16 2012
@@ -77,8 +77,8 @@ wclrtobot(WINDOW *win)
 		starty = win->cury;
 		startx = win->curx;
 	}
-	if (__using_color && win != curscr)
-		attr = win->battr & __COLOR;
+	if (win != curscr)
+		attr = win->battr & __ATTRIBUTES;
 	else
 		attr = 0;
 	for (y = starty; y < win->maxy; y++) {
@@ -89,12 +89,15 @@ wclrtobot(WINDOW *win)
 			if (sp->ch != win->bch || sp->attr != attr) {
 #else
 			if (sp->ch != (wchar_t)btowc((int) win->bch) ||
-			    (sp->attr & WA_ATTRIBUTES) != 0 || sp->nsp) {
+			    (sp->attr & WA_ATTRIBUTES) != attr || sp->nsp) {
 #endif /* HAVE_WCHAR */
 				maxx = sp;
 				if (minx == -1)
 					minx = (int)(sp - win->alines[y]->line);
-				sp->attr = attr;
+				if (sp->attr & __ALTCHARSET)
+					sp->attr = attr | __ALTCHARSET;
+				else
+					sp->attr = attr;
 #ifdef HAVE_WCHAR
 				sp->ch = ( wchar_t )btowc(( int ) win->bch);
 				if (_cursesi_copy_nsp(win->bnsp, sp) == ERR)
diff -pru src/lib/libcurses.orig/clrtoeol.c src/lib/libcurses/clrtoeol.c
--- src/lib/libcurses.orig/clrtoeol.c	Thu Jul 23 05:01:50 2009
+++ src/lib/libcurses/clrtoeol.c	Sat Feb 18 20:11:55 2012
@@ -82,8 +82,8 @@ wclrtoeol(WINDOW *win)
 	end = &win->alines[y]->line[win->maxx];
 	minx = -1;
 	maxx = &win->alines[y]->line[x];
-	if (__using_color && win != curscr)
-		attr = win->battr & __COLOR;
+	if (win != curscr)
+		attr = win->battr & __ATTRIBUTES;
 	else
 		attr = 0;
 	for (sp = maxx; sp < end; sp++)
@@ -97,7 +97,10 @@ wclrtoeol(WINDOW *win)
 			maxx = sp;
 			if (minx == -1)
 				minx = (int) (sp - win->alines[y]->line);
-			sp->attr = attr;
+			if (sp->attr & __ALTCHARSET)
+				sp->attr = attr | __ALTCHARSET;
+			else
+				sp->attr = attr;
 #ifdef HAVE_WCHAR
 			sp->ch = ( wchar_t )btowc(( int ) win->bch);
 			if (_cursesi_copy_nsp(win->bnsp, sp) == ERR)

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46049 CVS commit: src/lib/libcurses
Date: Sun, 19 Feb 2012 14:38:14 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sun Feb 19 19:38:14 UTC 2012

 Modified Files:
 	src/lib/libcurses: clrtobot.c clrtoeol.c

 Log Message:
 PR/46049: Tim van der Molen:
 clrtobot() and clrtoeol() do not set background attributes


 To generate a diff of this commit:
 cvs rdiff -u -r1.21 -r1.22 src/lib/libcurses/clrtobot.c
 cvs rdiff -u -r1.25 -r1.26 src/lib/libcurses/clrtoeol.c

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

State-Changed-From-To: open->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 20 Feb 2012 00:49:28 +0000
State-Changed-Why:
Christos committed it, ok to close?


From: Tim van der Molen <tbvdm@xs4all.nl>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/46049 (clrtobot() and clrtoeol() do not set background
 attributes)
Date: Mon, 20 Feb 2012 16:40:39 +0100

 On Mon, 20 Feb 2012 01:49:31 +0100, wiz@NetBSD.org wrote:
 > Synopsis: clrtobot() and clrtoeol() do not set background attributes
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: wiz@NetBSD.org
 > State-Changed-When: Mon, 20 Feb 2012 00:49:28 +0000
 > State-Changed-Why:
 > Christos committed it, ok to close?

 Yes, thanks.

State-Changed-From-To: feedback->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 20 Feb 2012 21:43:25 +0000
State-Changed-Why:
Confirmed fixed, thanks for the patch!


From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, netbsd-bugs@netbsd.org,
	gnats-admin@netbsd.org, wiz@NetBSD.org, tbvdm@xs4all.nl
Subject: Re: lib/46049 (clrtobot() and clrtoeol() do not set background
 attributes)
Date: Tue, 21 Feb 2012 07:02:10 +0000

 On Mon, Feb 20, 2012 at 09:43:26PM +0000, wiz@NetBSD.org wrote:
  > Synopsis: clrtobot() and clrtoeol() do not set background attributes
  > 
  > State-Changed-From-To: feedback->closed
  > State-Changed-By: wiz@NetBSD.org
  > State-Changed-When: Mon, 20 Feb 2012 21:43:25 +0000
  > State-Changed-Why:
  > Confirmed fixed, thanks for the patch!

 Shouldn't this be pulled up to -6?

 -- 
 David A. Holland
 dholland@netbsd.org

From: Brett Lymn <blymn@internode.on.net>
To: David Holland <dholland-bugs@netbsd.org>
Cc: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org,
	netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, wiz@NetBSD.org,
	tbvdm@xs4all.nl
Subject: Re: lib/46049 (clrtobot() and clrtoeol() do not set background attributes)
Date: Tue, 21 Feb 2012 19:36:46 +1030

 On Tue, Feb 21, 2012 at 07:02:10AM +0000, David Holland wrote:
 > On Mon, Feb 20, 2012 at 09:43:26PM +0000, wiz@NetBSD.org wrote:
 >  > Synopsis: clrtobot() and clrtoeol() do not set background attributes
 >  > 
 >  > State-Changed-From-To: feedback->closed
 >  > State-Changed-By: wiz@NetBSD.org
 >  > State-Changed-When: Mon, 20 Feb 2012 21:43:25 +0000
 >  > State-Changed-Why:
 >  > Confirmed fixed, thanks for the patch!
 > 
 > Shouldn't this be pulled up to -6?
 > 

 on the proviso that we get no complaints about curses broken-ness in the
 next few days I would say yes.  I don't expect any complaints as the
 behaviour now matches ncurses.

 -- 
 Brett Lymn
 Staple Guns: because duct tape doesn't make that KerCHUNK sound - xkcd.com

From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46049 CVS commit: [netbsd-6] src/lib/libcurses
Date: Sat, 17 Mar 2012 17:51:49 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sat Mar 17 17:51:48 UTC 2012

 Modified Files:
 	src/lib/libcurses [netbsd-6]: clrtobot.c clrtoeol.c

 Log Message:
 Pull up following revision(s) (requested by blymn in ticket #121):
 	lib/libcurses/clrtoeol.c: revision 1.26
 	lib/libcurses/clrtobot.c: revision 1.22
 PR/46049: Tim van der Molen:
 clrtobot() and clrtoeol() do not set background attributes


 To generate a diff of this commit:
 cvs rdiff -u -r1.21 -r1.21.8.1 src/lib/libcurses/clrtobot.c
 cvs rdiff -u -r1.25 -r1.25.8.1 src/lib/libcurses/clrtoeol.c

 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.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.