Bug#1057580: nfstrace: FTBFS: error: invalid use of incomplete type ‘WINDOW’ {aka ‘struct _win_st’}

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

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

> Package: src:nfstrace
> Version: 0.4.3.2+git20200805+b220d04-2.2
> Severity: serious
> Tags: ftbfs
>
> Dear maintainer:
>
> During a rebuild of all packages in unstable, your package failed to build:
>
> 
> [  7%] Building CXX object 
> analyzers/src/watch/CMakeFiles/watch.dir/nc_windows/header_window.cpp.o
> cd /<>/obj-x86_64-linux-gnu/analyzers/src/watch && /usr/bin/c++ 
> -Dwatch_EXPORTS -I/<>/src -I/usr/include/tirpc 
> -I/<>/analyzers/src/watch -g -O2 
> -ffile-prefix-map=/<>=. -fstack-protector-strong 
> -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection 
> -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++14 -pedantic -Wall -Werror -Wextra 
> -Wno-invalid-offsetof -Wno-error=address-of-packed-member -fPIC 
> -fvisibility=hidden -fPIC -MD -MT 
> analyzers/src/watch/CMakeFiles/watch.dir/nc_windows/header_window.cpp.o -MF 
> CMakeFiles/watch.dir/nc_windows/header_window.cpp.o.d -o 
> CMakeFiles/watch.dir/nc_windows/header_window.cpp.o -c 
> /<>/analyzers/src/watch/nc_windows/header_window.cpp
> /<>/analyzers/src/watch/nc_windows/header_window.cpp: In member 
> function ‘void HeaderWindow::resize(MainWindow&)’:
> /<>/analyzers/src/watch/nc_windows/header_window.cpp:90:72: 
> error: invalid use of incomplete type ‘WINDOW’ {aka ‘struct _win_st’}
>90 | _window = subwin(m._window, 
> std::min(static_cast(m._window->_maxy), GUI_HEADER_HEIGHT), 
> std::min(static_cast(m._window->_maxx), GUI_LENGTH), 0, 0);
>   |   
>  ^~
> In file included from 
> /<>/analyzers/src/watch/nc_windows/header_window.h:25,
>  from 
> /<>/analyzers/src/watch/nc_windows/header_window.cpp:28:
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>   |^~~
> /<>/analyzers/src/watch/nc_windows/header_window.cpp:90:137: 
> error: invalid use of incomplete type ‘WINDOW’ {aka ‘struct _win_st’}
>90 | _window = subwin(m._window, 
> std::min(static_cast(m._window->_maxy), GUI_HEADER_HEIGHT), 
> std::min(static_cast(m._window->_maxx), GUI_LENGTH), 0, 0);
>   |   
>   ^~
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>   |^~~
> make[3]: *** [analyzers/src/watch/CMakeFiles/watch.dir/build.make:79: 
> analyzers/src/watch/CMakeFiles/watch.dir/nc_windows/header_window.cpp.o] 
> Error 1

The attached patch fixes these errors and similar ones in
analyzers/src/watch/nc_windows/statistics_window.cpp.  Note that
getmaxx(window) returns window->_maxx + 1, and similar for getmaxy().

Disclaimer: I have only tested that the package builds, not if it works.

Cheers,
   Sven

From dcffbee1fa8170fdf6906791eb0239fac63e5333 Mon Sep 17 00:00:00 2001
From: Sven Joachim 
Date: Thu, 21 Dec 2023 17:12:56 +0100
Subject: [PATCH] Fix FTBFS with opqaque ncurses

Since ncurses patchlevel 20231021 the WINDOW structure is opaque, its
members cannot be addressed directly.  Use the getmaxy/getmaxx
functions ncurses provides for this purpose instead.
---
 analyzers/src/watch/nc_windows/header_window.cpp | 2 +-
 analyzers/src/watch/nc_windows/statistics_window.cpp | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/analyzers/src/watch/nc_windows/header_window.cpp b/analyzers/src/watch/nc_windows/header_window.cpp
index a376488..047d555 100644
--- a/analyzers/src/watch/nc_windows/header_window.cpp
+++ b/analyzers/src/watch/nc_windows/header_window.cpp
@@ -87,7 +87,7 @@ void HeaderWindow::resize(MainWindow& m)
 }
 if(m._window != nullptr)
 {
-_window = subwin(m._window, std::min(static_cast(m._window->_maxy), GUI_HEADER_HEIGHT), std::min(static_cast(m._window->_maxx), GUI_LENGTH), 0, 0);
+_window = subwin(m._window, std::min(static_cast(getmaxy(m._window) - 1 ), GUI_HEADER_HEIGHT), std::min(static_cast(getmaxx(m._window) - 1 ), GUI_LENGTH), 0, 0);
 }
 if(_window != nullptr)
 {
diff --git a/analyzers/src/watch/nc_windows/statistics_window.cpp b/analyzers/src/watch/nc_windows/statistics_window.cpp
index b580bba..c2e27fc 100644
--- a/analyzers/src/watch/nc_windows/statistics_window.cpp
+++ b/analyzers/src/watch/nc_windows/statistics_window.cpp
@@ -50,7 +50,7 @@ void StatisticsWindow::destroy()

 bool StatisticsWindow::canWrite(unsigned int i)
 {
-return (i >= _scrollOffset.at(_activeProtocol) + STATISTICS::FIRST_OPERATION_LINE && i - _scrollOffset.at(_activeProtocol) + BORDER_SIZE < static_cast(_window->_maxy));
+return (i >= _scrollOffset.at(_activeProtocol) + 

Bug#1057580: nfstrace: FTBFS: error: invalid use of incomplete type ‘WINDOW’ {aka ‘struct _win_st’}

2023-12-05 Thread Santiago Vila

Package: src:nfstrace
Version: 0.4.3.2+git20200805+b220d04-2.2
Severity: serious
Tags: ftbfs

Dear maintainer:

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


[...]
 debian/rules build
dh build
   dh_update_autotools_config
   dh_autoreconf
   debian/rules override_dh_auto_configure
make[1]: Entering directory '/<>'
dh_auto_configure -- -DGMOCK_SOURCE_DIR=/usr/src/gmock
cd obj-x86_64-linux-gnu && DEB_PYTHON_INSTALL_LAYOUT=deb cmake 
-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc 
-DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON 
-DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON 
-DFETCHCONTENT_FULLY_DISCONNECTED=ON -DCMAKE_INSTALL_RUNSTATEDIR=/run 
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON 
-DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DGMOCK_SOURCE_DIR=/usr/src/gmock ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument  value or use a ... suffix to tell
  CMake that the project does not need compatibility with older versions.

[... snipped ...]

Patching output file 2295/2575
Patching output file 2296/2575
Patching output file 2297/2575
Patching output file 2298/2575
Patching output file 2299/2575
Patching output file 2300/2575
Patching output file 2301/2575
Patching output file 2302/2575
Patching output file 2303/2575
Patching output file 2304/2575
Patching output file 2305/2575
Patching output file 2306/2575
Patching output file 2307/2575
Patching output file 2308/2575
Patching output file 2309/2575
Patching output file 2310/2575
Patching output file 2311/2575
Patching output file 2312/2575
Patching output file 2313/2575
Patching output file 2314/2575
Patching output file 2315/2575
Patching output file 2316/2575
Patching output file 2317/2575
Patching output file 2318/2575
Patching output file 2319/2575
Patching output file 2320/2575
Patching output file 2321/2575
Patching output file 2322/2575
Patching output file 2323/2575
Patching output file 2324/2575
Patching output file 2325/2575
Patching output file 2326/2575
Patching output file 2327/2575
Patching output file 2328/2575
Patching output file 2329/2575
Patching output file 2330/2575
Patching output file 2331/2575
Patching output file 2332/2575
Patching output file 2333/2575
Patching output file 2334/2575
Patching output file 2335/2575
Patching output file 2336/2575
Patching output file 2337/2575
Patching output file 2338/2575
Patching output file 2339/2575
Patching output file 2340/2575
Patching output file 2341/2575
Patching output file 2342/2575
Patching output file 2343/2575
Patching output file 2344/2575
Patching output file 2345/2575
Patching output file 2346/2575
Patching output file 2347/2575
Patching output file 2348/2575
Patching output file 2349/2575
Patching output file 2350/2575
Patching output file 2351/2575
Patching output file 2352/2575
Patching output file 2353/2575
Patching output file 2354/2575
Patching output file 2355/2575
Patching output file 2356/2575
Patching output file 2357/2575
Patching output file 2358/2575
Patching output file 2359/2575
Patching output file 2360/2575
Patching output file 2361/2575
Patching output file 2362/2575
Patching output file 2363/2575
Patching output file 2364/2575
Patching output file 2365/2575
Patching output file 2366/2575
Patching output file 2367/2575
Patching output file 2368/2575
Patching output file 2369/2575
Patching output file 2370/2575
Patching output file 2371/2575
Patching output file 2372/2575
Patching output file 2373/2575
Patching output file 2374/2575
Patching output file 2375/2575
Patching output file 2376/2575
Patching output file 2377/2575
Patching output file 2378/2575
Patching output file 2379/2575
Patching output file 2380/2575
Patching output file 2381/2575
Patching output file 2382/2575
Patching output file 2383/2575
Patching output file 2384/2575
Patching output file 2385/2575
Patching output file 2386/2575
Patching output file 2387/2575
Patching output file 2388/2575
Patching output file 2389/2575
Patching output file 2390/2575
Patching output file 2391/2575
Patching output file 2392/2575
Patching output file 2393/2575
Patching output file 2394/2575
Patching output file 2395/2575
Patching output file 2396/2575
Patching output file 2397/2575
Patching output file 2398/2575
Patching output file 2399/2575
Patching output file 2400/2575
Patching output file 2401/2575
Patching output file 2402/2575
Patching output file 2403/2575
Patching output file 2404/2575
Patching output file 2405/2575
Patching output file 2406/2575
Patching output file 2407/2575
Patching output file 2408/2575
Patching output file 2409/2575
Patching output file 2410/2575
Patching output file 2411/2575
Patching output