Control: tags -1 + trixie sid patch

On 2023-12-04 10:38 +0100, Chris Hofstaedtler wrote:

> Source: aalib
> Version: 1.4p5-50
> Severity: serious
> Tags: ftbfs
>
> Rebuilding your package in unstable currently fails:
>
>
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -Wdate-time
> -D_FORTIFY_SOURCE=2 -g -O2
> -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong
> -fstack-clash-protection -Wformat -Werror=format-security
> -fcf-protection -I/usr/include -I/usr/include/ncurses -c aacurses.c
> -fPIC -DPIC -o .libs/aacurses.o
> aacurses.c: In function ‘curses_getsize’:
> aacurses.c:80:20: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>    80 |     *width = stdscr->_maxx + 1;
>       |                    ^~
> aacurses.c:81:21: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>    81 |     *height = stdscr->_maxy + 1;
>       |                     ^~
> make[4]: *** [Makefile:726: aacurses.lo] Error 1

This has been caused by a recent change in ncurses which makes the
WINDOW structure opaque.  Accessing its members directly is no longer
possible, you need to use library functions to obtain window dimensions
and positions.  In the current case, this would be getmaxyx(), see the
attached patch.

See the ncurses INSTALL file:

,----
|     --enable-opaque-curses
|     --enable-opaque-form
|     --enable-opaque-menu
|     --enable-opaque-panel
|       Define symbol in curses.h controlling whether some library structures
|       are opaque, meaning that their members are accessible only via the
|       documented API.  The --enable-opaque-curses option may be overridden
|       by the --enable-reentrant option.
| 
|       Enabling opaque-curses enables opaque for the form, menu, and panel
|       libraries.  Use their corresponding options to disable the feature
|       individually.
| 
|       NOTE: beginning with ncurses 6.5 this option is enabled by default;
|       older versions disable it by default.
`----

While ncurses 6.5 has not been released yet, the change has already been
made in the patchlevel Debian is shipping.  From the NEWS file:

,----
| 20231021
|       + change defaults for configure opaque and widec options (prompted by
|         discussion with Branden Robinson).
`----

Cheers,
       Sven (ncurses maintainer in Debian)

From 033d7355157688eb3bc224b973b130f42d5664b1 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Mon, 4 Dec 2023 17:45:59 +0100
Subject: [PATCH] Use getmaxyx() to obtain width and height

Ncurses patchlevel 20231021 made the WINDOW scructure opaque, so it is
no longer possible to directly access its members, leading to FTBFS.

Closes: #1057381
---
 src/aacurses.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/aacurses.c b/src/aacurses.c
index dc3b220..ae7e097 100644
--- a/src/aacurses.c
+++ b/src/aacurses.c
@@ -77,8 +77,7 @@ static void curses_getsize(aa_context * c, int *width, int *height)
 {
     if (__resized_curses)
 	curses_uninit(c), curses_init(&c->params, NULL,&c->driverparams, NULL), __resized_curses = 0;
-    *width = stdscr->_maxx + 1;
-    *height = stdscr->_maxy + 1;
+    getmaxyx(stdscr, *width, *height);
 #ifdef GPM_MOUSEDRIVER
     gpm_mx = *width;
     gpm_my = *height;
--
2.43.0

Reply via email to