GNU bug report logs - #54607
ncurses attrset colour pair ignored in favour of bkgd

Previous Next

Package: guix;

Reported by: Roman Riabenko <roman <at> riabenko.com>

Date: Mon, 28 Mar 2022 12:02:02 UTC

Severity: normal

Done: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54607 in the body.
You can then email your comments to 54607 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#54607; Package guix. (Mon, 28 Mar 2022 12:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roman Riabenko <roman <at> riabenko.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 28 Mar 2022 12:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Roman Riabenko <roman <at> riabenko.com>
To: bug-guix <at> gnu.org
Subject: ncurses attrset colour pair ignored in favour of bkgd
Date: Mon, 28 Mar 2022 15:00:52 +0300
[Message part 1 (text/plain, inline)]
Hello

With ncurses, the "attrset" colour pair is ignored when the background
colour pair is set with "bkgd".

I ran into this issue when compiling robotfindskitten, but it is not
specific to that program and can be reproduced with the attached small
test code. When compiled with "gcc test.c -lncurses", "./a.out" is
expected to display the sample text in yellow (the brownish curses
equivalent of yellow), which is set with "attrset". It does so when
compiled as usual without guix. If compiled in guix, the sample text is
blue instead, which is set with "bkgd" for background and for some
reason is not overridden by "attrset". If the "bkgd" line is removed,
"attrset" works as usual.

This affects software compiled in a guix shell (guix environment), or
on a guix system, or with "guix build" and "guix install".

It does not seem to be caused by the terminal properties or environment
variables because it can be reproduced on the same Debian machine after
compiling (1) with guix (in a guix environment) and (2) without guix.

I tried compiling with guix having ncurses 6.2.20210619 (current guix)
and 6.2.20200212 (from the older guix image from the website and in
Debian bullseye). I tried compiling without guix on Debian with
development packages for ncurses 6.2+20201114-2 (bullseye) and 6.3-2
(bookworm) and on Fedora with its development package for ncurses
6.2.20210508.

I was pointed in a forum to "render_char" function in lib_addch.c, [1]
which defines how colour is applied. But there seem to be no
modifications to that in guix as far as I can see.

[1]:
https://github.com/ThomasDickey/ncurses-snapshots/blob/6b3112c16ee04882a512f9aa967e34dba5e362e1/ncurses/base/lib_addch.c#L57

Roman
[test.c (text/x-csrc, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#54607; Package guix. (Tue, 29 Mar 2022 12:30:02 GMT) Full text and rfc822 format available.

Message #8 received at 54607 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>
To: Roman Riabenko <roman <at> riabenko.com>, 54607 <at> debbugs.gnu.org
Subject: Re: ncurses attrset colour pair ignored in favour of bkgd
Date: Tue, 29 Mar 2022 14:29:20 +0200
Am Montag, dem 28.03.2022 um 15:00 +0300 schrieb Roman Riabenko:
> gcc test.c -lncurses
This is not a sufficient invocation to get ncurses working correctly.

$ ncursesw6-config --cflags
-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -
I/gnu/store/9rrnm5hdjw7cy96a2a9rfgh6y08wsbmf-ncurses-
6.2.20210619/include

$ ncursesw6-config --libs  
-L/gnu/store/9rrnm5hdjw7cy96a2a9rfgh6y08wsbmf-ncurses-6.2.20210619/lib
-Wl,-rpath=/gnu/store/9rrnm5hdjw7cy96a2a9rfgh6y08wsbmf-ncurses-
6.2.20210619/lib -lncursesw

$ pkg-config --cflags ncurses
-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -
I/gnu/store/9rrnm5hdjw7cy96a2a9rfgh6y08wsbmf-ncurses-
6.2.20210619/include

$ pkg-config --libs ncurses  
-Wl,-rpath=/gnu/store/9rrnm5hdjw7cy96a2a9rfgh6y08wsbmf-ncurses-
6.2.20210619/lib -lncursesw

Cheers




Information forwarded to bug-guix <at> gnu.org:
bug#54607; Package guix. (Thu, 07 Apr 2022 12:51:02 GMT) Full text and rfc822 format available.

Message #11 received at 54607 <at> debbugs.gnu.org (full text, mbox):

From: Roman Riabenko <roman <at> riabenko.com>
To: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>, 
 54607 <at> debbugs.gnu.org
Subject: Re: ncurses attrset colour pair ignored in favour of bkgd
Date: Thu, 07 Apr 2022 15:50:03 +0300
Hello

Thank you for directing me to those options.

Setting _XOPEN_SOURCE to 500 or higher seems to restore the expected
functionality of attrset in ncurses for colour. _XOPEN_SOURCE is a
feature test macro, so it just determines that some functionality from
X/Open is used (X/OPEN 5 for _XOPEN_SOURCE 500, X/OPEN 6 for
_XOPEN_SOURCE 600, etc.). The program that is being compiled can have
its own tests for functionality that it needs. I can add "#define
_XOPEN_SOURCE 500" to the beginning of test.c from my previous email to
make it work as it should when built with guix. So, this is something,
the program could normally figure out itself without relying on curses
being implemented in a specific way.

There is a section on alternate configurations of ncurses in its manual
[1] noting that it may be necessary for some functionality of ncurses
to specify _XOPEN_SOURCE up to 600 for programs compiled against
ncurses when the latter was built with --enable-widec. Since this
option was chosen for ncurses in guix, it is fair enough that some
functionality may need _XOPEN_SOURCE 600, even if I am not sure how my
case is related to wide character support or what functionality from
X/Open is used.

[1]:
https://invisible-island.net/ncurses/man/ncurses.3x.html#h2-ALTERNATE-CONFIGURATIONS

I believe that the above is enough to close this issue.

Roman




Reply sent to Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>:
You have taken responsibility. (Thu, 07 Apr 2022 12:53:02 GMT) Full text and rfc822 format available.

Notification sent to Roman Riabenko <roman <at> riabenko.com>:
bug acknowledged by developer. (Thu, 07 Apr 2022 12:53:02 GMT) Full text and rfc822 format available.

Message #16 received at 54607-done <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>
To: Roman Riabenko <roman <at> riabenko.com>, 54607-done <at> debbugs.gnu.org
Subject: Re: ncurses attrset colour pair ignored in favour of bkgd
Date: Thu, 07 Apr 2022 14:52:31 +0200
Am Donnerstag, dem 07.04.2022 um 15:50 +0300 schrieb Roman Riabenko:
> I believe that the above is enough to close this issue.
Consider it closed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 06 May 2022 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 350 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.