Control: tags -1 + patch

On 2023-12-05 23:03 +0100, Santiago Vila wrote:

> Package: src:bosh
> Version: 0.6-11
> Severity: serious
> Tags: ftbfs
>
> Dear maintainer:
>
> During a rebuild of all packages in unstable, your package failed to build:
>
> --------------------------------------------------------------------------------
> [...]
> gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" 
> -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" 
> -DPACKAGE=\"bosh\" -DVERSION=\"0.6\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 
> -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 
> -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 
> -DHAVE_LIBNCURSES=1 -I.   -Wdate-time -D_FORTIFY_SOURCE=2  -Wall -g -O2 
> -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong 
> -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c 
> -o bosh.o bosh.c
> In file included from bosh.c:23:
> bosh.c: In function ‘keyhandler_readstr’:
> bosh.c:453:23: error: invalid use of incomplete typedef ‘WINDOW’ {aka ‘struct 
> _win_st’}
>   453 |         mvaddch(stdscr->_cury,stdscr->_curx-1,' ');
>       |                       ^~
> bosh.c:453:37: error: invalid use of incomplete typedef ‘WINDOW’ {aka ‘struct 
> _win_st’}
>   453 |         mvaddch(stdscr->_cury,stdscr->_curx-1,' ');
>       |                                     ^~
> bosh.c:454:20: error: invalid use of incomplete typedef ‘WINDOW’ {aka ‘struct 
> _win_st’}
>   454 |         move(stdscr->_cury,stdscr->_curx-1);
>       |                    ^~
> bosh.c:454:34: error: invalid use of incomplete typedef ‘WINDOW’ {aka ‘struct 
> _win_st’}
>   454 |         move(stdscr->_cury,stdscr->_curx-1);
>       |                                  ^~

The attached patch fixes that, using the getcury()/getcurx() functions
rather than accessing the stdscr structure directly which no longer
works in current ncurses.  It is straightforward, but I have only tested
that bosh builds, not if it works.

Cheers,
       Sven

From 4e13fe3db4df26574709c107a24bed9eb8b1924b Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Sat, 16 Dec 2023 19:30:56 +0100
Subject: [PATCH] Avoid accessing internal ncurses structures

Since ncurses patchlevel 20231021 the WINDOW structure is opaque, its
members cannot be addressed directly.  Use the functions ncurses
provides for this purpose instead.
---
 bosh.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bosh.c b/bosh.c
index 7c634a4..4133c18 100644
--- a/bosh.c
+++ b/bosh.c
@@ -450,8 +450,8 @@ int *keyhandler_readstr(int key) {
     case KEY_BACKSPACE:
       if(strlen(REPLY)) {
         REPLY[strlen(REPLY)-1] = 0;
-        mvaddch(stdscr->_cury,stdscr->_curx-1,' ');
-        move(stdscr->_cury,stdscr->_curx-1);
+        mvaddch(getcury(stdscr),getcurx(stdscr)-1,' ');
+        move(getcury(stdscr),getcurx(stdscr)-1);
       }
       break;
     case '\n':
--
2.43.0

Reply via email to