Bug#1057930: cunit: FTBFS: invalid use of incomplete typedef ‘WINDOW’ {aka ‘struct _win_st’}

2023-12-16 Thread Sven Joachim
Control: tags -1 + patch

On 2023-12-10 20:17 +0100, Santiago Vila wrote:

> Package: src:cunit
> Version: 2.1-3-dfsg-2.6
> Severity: serious
> Tags: ftbfs
>
> Dear maintainer:
>
> During a rebuild of all packages in unstable, your package failed to build:
>
> 
> [...]
>>/debian/build-ncurses/CUnit/Headers -std=c99 -c -o Curses.lo Curses.c
> Curses.c: In function ‘initialize_windows’:
> Curses.c:259:41: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   259 |   f_nLeft = application_windows.pMainWin->_begx;
>   | ^~
> Curses.c:260:40: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   260 |   f_nTop = application_windows.pMainWin->_begy;
>   |^~
> Curses.c:261:42: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   261 |   f_nWidth = application_windows.pMainWin->_maxx;
>   |  ^~
> Curses.c:262:43: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   262 |   f_nHeight = application_windows.pMainWin->_maxy;
>   |   ^~
> Curses.c: In function ‘refresh_windows’:
> Curses.c:361:41: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   361 |   f_nLeft = application_windows.pMainWin->_begx;
>   | ^~
> Curses.c:362:40: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   362 |   f_nTop = application_windows.pMainWin->_begy;
>   |^~
> Curses.c:363:42: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   363 |   f_nWidth = application_windows.pMainWin->_maxx;
>   |  ^~
> Curses.c:364:43: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   364 |   f_nHeight = application_windows.pMainWin->_maxy;
>   |   ^~
> Curses.c: In function ‘create_pad’:
> Curses.c:910:52: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   910 |   pPad->uiWinLeft = application_windows.pDetailsWin->_begx + 1;
>   |^~
> Curses.c:911:51: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   911 |   pPad->uiWinTop = application_windows.pDetailsWin->_begy + 1;
>   |   ^~
> Curses.c:912:55: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   912 |   pPad->uiWinColumns = application_windows.pDetailsWin->_maxx - 2;
>   |   ^~
> Curses.c:913:52: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   913 |   pPad->uiWinRows = application_windows.pDetailsWin->_maxy - 2;
>   |^~

The attached patch, which can be added to the series file, fixes these
errors, but I have only tested that the package builds, not if it works.
Note that getmaxx(win) returns win->_maxx + 1, and similar for getmaxy.

Cheers,
   Sven

From 6412a56519dabfc18365d97abb06388c029d84aa Mon Sep 17 00:00:00 2001
From: Sven Joachim 
Date: Sat, 16 Dec 2023 11:23:40 +0100
Subject: [PATCH] Fix FTBFS with newer ncurses

Since ncurses patchlevel 20231021 the WINDOW structure is opaque, its
members cannot be addressed directly.  Use the functions ncurses
provides for this purpose instead.
---
 CUnit/Sources/Curses/Curses.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/CUnit/Sources/Curses/Curses.c b/CUnit/Sources/Curses/Curses.c
index 17eaa30..eda272e 100644
--- a/CUnit/Sources/Curses/Curses.c
+++ b/CUnit/Sources/Curses/Curses.c
@@ -256,10 +256,10 @@ static bool initialize_windows(void)

   start_color();

-  f_nLeft = application_windows.pMainWin->_begx;
-  f_nTop = application_windows.pMainWin->_begy;
-  f_nWidth = application_windows.pMainWin->_maxx;
-  f_nHeight = application_windows.pMainWin->_maxy;
+  f_nLeft = getbegx(application_windows.pMainWin);
+  f_nTop = getbegy(application_windows.pMainWin);
+  f_nWidth = getmaxx(application_windows.pMainWin) - 1;
+  f_nHeight = getmaxy(application_windows.pMainWin) - 1;

   if (NULL == (application_windows.pTitleWin = newwin(3, f_nWidth, 0, 0))) {
 goto title_fail;
@@ -358,10 +358,10 @@ static void refresh_windows(void)
 {
   refresh();

-  f_nLeft = application_windows.pMainWin->_begx;
-  f_nTop = application_windows.pMainWin->_begy;
-  f_nWidth = application_windows.pMainWin->_maxx;
-  f_nHeight = application_windows.pMainWin->_maxy;
+  f_nLeft = getbegx(application_windows.pMainWin);
+  f_nTop = 

Bug#1057930: cunit: FTBFS: invalid use of incomplete typedef ‘WINDOW’ {aka ‘struct _win_st’}

2023-12-10 Thread Santiago Vila

Package: src:cunit
Version: 2.1-3-dfsg-2.6
Severity: serious
Tags: ftbfs

Dear maintainer:

During a rebuild of all packages in unstable, your package failed to build:


[...]
 debian/rules binary
dh binary --with autoreconf
dh: warning: Compatibility levels before 10 are deprecated (level 9 in use)
   dh_update_autotools_config
cp -an --reflink=auto config.guess 
debian/.debhelper/bucket/files/1d9048b0ac9d4d1dfce7aa4e3a0b59ccfd32db2f7693814aa6f4c778560f5669.tmp
mv 
debian/.debhelper/bucket/files/1d9048b0ac9d4d1dfce7aa4e3a0b59ccfd32db2f7693814aa6f4c778560f5669.tmp
 
debian/.debhelper/bucket/files/1d9048b0ac9d4d1dfce7aa4e3a0b59ccfd32db2f7693814aa6f4c778560f5669
cp -f /usr/share/misc/config.guess ./config.guess
cp -an --reflink=auto config.sub 
debian/.debhelper/bucket/files/4add30a10b137a5a4667e12868fb4783e385dbf865cfb7017b205321bd1a2f39.tmp
mv 
debian/.debhelper/bucket/files/4add30a10b137a5a4667e12868fb4783e385dbf865cfb7017b205321bd1a2f39.tmp
 
debian/.debhelper/bucket/files/4add30a10b137a5a4667e12868fb4783e385dbf865cfb7017b205321bd1a2f39
cp -f /usr/share/misc/config.sub ./config.sub
   dh_autoreconf
find ! -ipath "./debian/*" -a ! \( -path '*/.git/*' -o -path '*/.hg/*' -o 
-path '*/.bzr/*' -o -path '*/.svn/*' -o -path '*/CVS/*' \) -a  -type f -exec md5sum {} + -o 
-type l -printf "symlink  %p
" > debian/autoreconf.before
grep -q ^XDT_ configure.in

[... snipped ...]

  |   
  ||
  |size_t {aka long unsigned int}
Console.c:504:29: warning: field width specifier ‘*’ expects argument of type 
‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  504 |   fprintf(stdout, "\n%*s  %-*s%*s%*s%*s%*s\n",
  |   ~~^~
  | |
  | int
  505 |   width[0], _("#"),
  506 |   width[1], _("Suite Name"),
  |   
  ||
  |size_t {aka long unsigned int}
Console.c:504:32: warning: field width specifier ‘*’ expects argument of type 
‘int’, but argument 7 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  504 |   fprintf(stdout, "\n%*s  %-*s%*s%*s%*s%*s\n",
  |   ~^~
  ||
  |int
..
  507 |   width[2], _("Init?"),
  |   
  ||
  |size_t {aka long unsigned int}
Console.c:504:35: warning: field width specifier ‘*’ expects argument of type 
‘int’, but argument 9 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  504 |   fprintf(stdout, "\n%*s  %-*s%*s%*s%*s%*s\n",
  |  ~^~
  |   |
  |   int
..
  508 |   width[3], _("Cleanup?"),
  |   
  ||
  |size_t {aka long unsigned int}
Console.c:504:38: warning: field width specifier ‘*’ expects argument of type 
‘int’, but argument 11 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  504 |   fprintf(stdout, "\n%*s  %-*s%*s%*s%*s%*s\n",
  | ~^~
  |  |
  |  int
..
  509 |   width[4], _("#Tests"),
  |   
  ||
  |size_t {aka long unsigned int}
Console.c:504:41: warning: field width specifier ‘*’ expects argument of type 
‘int’, but argument 13 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  504 |   fprintf(stdout, "\n%*s  %-*s%*s%*s%*s%*s\n",
  |~^~
  | |
  | int
..
  510 |   width[5], _("Active?"));
  |   
  ||
  |size_t {aka long unsigned int}
Console.c:514:25: warning: field width specifier ‘*’ expects argument of type 
‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  514 | fprintf(stdout, "\n%*d. %-*.*s%*s%*s%*u%*s",
  |~^~
  | |
  | int
  515 | width[0], i,
  | 
  |  |
  |  size_t {aka long unsigned int}
Console.c:514:31: warning: field width specifier ‘*’ expects argument of type 
‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]