Control: tags -1 + patch

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

> Package: src:ydpdict
> Version: 1.0.4-1
> Severity: serious
> Tags: ftbfs
>
> Dear maintainer:
>
> During a rebuild of all packages in unstable, your package failed to build:
>
> --------------------------------------------------------------------------------
> [...]
> gcc -DHAVE_CONFIG_H -I. -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 
> -DHAVE_CONFIG_H   -DSYSCONFDIR=\"/etc\" -g -O2 
> -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong 
> -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection 
> -DHAVE_CONFIG_H -c -o ydpdict-ydpdict.o `test -f 'ydpdict.c' || echo 
> './'`ydpdict.c
> ydpdict.c: In function ‘check_size’:
> ydpdict.c:324:22: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   324 |         newx = stdscr->_maxx + 1;
>       |                      ^~
> ydpdict.c:325:22: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   325 |         newy = stdscr->_maxy + 1;
>       |                      ^~
> ydpdict.c: In function ‘main’:
> ydpdict.c:855:27: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                           ^~
> ydpdict.c:862:88: note: in expansion of macro ‘__MOUSE_IN’
>   862 |                                         if (m_event.bstate & 
> BUTTON1_DOUBLE_CLICKED && __MOUSE_IN(window_def, m_event, -2, 1, -3, 2)) {
>       |                                                                       
>                  ^~~~~~~~~~
> ydpdict.c:855:67: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                                                                   ^~
> ydpdict.c:862:88: note: in expansion of macro ‘__MOUSE_IN’
>   862 |                                         if (m_event.bstate & 
> BUTTON1_DOUBLE_CLICKED && __MOUSE_IN(window_def, m_event, -2, 1, -3, 2)) {
>       |                                                                       
>                  ^~~~~~~~~~
> ydpdict.c:855:83: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                                                                       
>             ^~
> ydpdict.c:862:88: note: in expansion of macro ‘__MOUSE_IN’
>   862 |                                         if (m_event.bstate & 
> BUTTON1_DOUBLE_CLICKED && __MOUSE_IN(window_def, m_event, -2, 1, -3, 2)) {
>       |                                                                       
>                  ^~~~~~~~~~
> ydpdict.c:856:27: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                           ^~
> ydpdict.c:862:88: note: in expansion of macro ‘__MOUSE_IN’
>   862 |                                         if (m_event.bstate & 
> BUTTON1_DOUBLE_CLICKED && __MOUSE_IN(window_def, m_event, -2, 1, -3, 2)) {
>       |                                                                       
>                  ^~~~~~~~~~
> ydpdict.c:856:67: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                                                                   ^~
> ydpdict.c:862:88: note: in expansion of macro ‘__MOUSE_IN’
>   862 |                                         if (m_event.bstate & 
> BUTTON1_DOUBLE_CLICKED && __MOUSE_IN(window_def, m_event, -2, 1, -3, 2)) {
>       |                                                                       
>                  ^~~~~~~~~~
> ydpdict.c:856:83: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                                                                       
>             ^~
> ydpdict.c:862:88: note: in expansion of macro ‘__MOUSE_IN’
>   862 |                                         if (m_event.bstate & 
> BUTTON1_DOUBLE_CLICKED && __MOUSE_IN(window_def, m_event, -2, 1, -3, 2)) {
>       |                                                                       
>                  ^~~~~~~~~~
> ydpdict.c:887:104: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   887 |                                                 } while 
> ((iswalpha(ch) || ch == L'-') && x < window_def->_maxx);
>       |                                                                       
>                                  ^~
> ydpdict.c:855:27: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                           ^~
> ydpdict.c:905:53: note: in expansion of macro ‘__MOUSE_IN’
>   905 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -1, 1) && m_event.y > 2) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:855:67: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                                                                   ^~
> ydpdict.c:905:53: note: in expansion of macro ‘__MOUSE_IN’
>   905 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -1, 1) && m_event.y > 2) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:855:83: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                                                                       
>             ^~
> ydpdict.c:905:53: note: in expansion of macro ‘__MOUSE_IN’
>   905 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -1, 1) && m_event.y > 2) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:27: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                           ^~
> ydpdict.c:905:53: note: in expansion of macro ‘__MOUSE_IN’
>   905 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -1, 1) && m_event.y > 2) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:67: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                                                                   ^~
> ydpdict.c:905:53: note: in expansion of macro ‘__MOUSE_IN’
>   905 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -1, 1) && m_event.y > 2) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:83: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                                                                       
>             ^~
> ydpdict.c:905:53: note: in expansion of macro ‘__MOUSE_IN’
>   905 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -1, 1) && m_event.y > 2) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:855:27: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                           ^~
> ydpdict.c:934:53: note: in expansion of macro ‘__MOUSE_IN’
>   934 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -3, 2) && focus) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:855:67: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                                                                   ^~
> ydpdict.c:934:53: note: in expansion of macro ‘__MOUSE_IN’
>   934 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -3, 2) && focus) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:855:83: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                                                                       
>             ^~
> ydpdict.c:934:53: note: in expansion of macro ‘__MOUSE_IN’
>   934 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -3, 2) && focus) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:27: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                           ^~
> ydpdict.c:934:53: note: in expansion of macro ‘__MOUSE_IN’
>   934 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -3, 2) && focus) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:67: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                                                                   ^~
> ydpdict.c:934:53: note: in expansion of macro ‘__MOUSE_IN’
>   934 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -3, 2) && focus) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:83: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                                                                       
>             ^~
> ydpdict.c:934:53: note: in expansion of macro ‘__MOUSE_IN’
>   934 |                                                 if 
> (__MOUSE_IN(window_word, m_event, -2, 1, -3, 2) && focus) {
>       |                                                     ^~~~~~~~~~
> ydpdict.c:855:27: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                           ^~
> ydpdict.c:940:53: note: in expansion of macro ‘__MOUSE_IN’
>   940 |                                                 if 
> (__MOUSE_IN(window_def, m_event, -2, 1, -3, 2) && !focus)
>       |                                                     ^~~~~~~~~~
> ydpdict.c:855:67: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                                                                   ^~
> ydpdict.c:940:53: note: in expansion of macro ‘__MOUSE_IN’
>   940 |                                                 if 
> (__MOUSE_IN(window_def, m_event, -2, 1, -3, 2) && !focus)
>       |                                                     ^~~~~~~~~~
> ydpdict.c:855:83: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   855 |          event.y > (window->_begy + correct1) && event.y < 
> (window->_begy + window->_maxy + correct2) &&\
>       |                                                                       
>             ^~
> ydpdict.c:940:53: note: in expansion of macro ‘__MOUSE_IN’
>   940 |                                                 if 
> (__MOUSE_IN(window_def, m_event, -2, 1, -3, 2) && !focus)
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:27: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                           ^~
> ydpdict.c:940:53: note: in expansion of macro ‘__MOUSE_IN’
>   940 |                                                 if 
> (__MOUSE_IN(window_def, m_event, -2, 1, -3, 2) && !focus)
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:67: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                                                                   ^~
> ydpdict.c:940:53: note: in expansion of macro ‘__MOUSE_IN’
>   940 |                                                 if 
> (__MOUSE_IN(window_def, m_event, -2, 1, -3, 2) && !focus)
>       |                                                     ^~~~~~~~~~
> ydpdict.c:856:83: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   856 |          event.x > (window->_begx + correct3) && event.x < 
> (window->_begx + window->_maxx + correct4))
>       |                                                                       
>             ^~
> ydpdict.c:940:53: note: in expansion of macro ‘__MOUSE_IN’
>   940 |                                                 if 
> (__MOUSE_IN(window_def, m_event, -2, 1, -3, 2) && !focus)
>       |                                                     ^~~~~~~~~~

The attached patch should fix these errors, but I have only tested that
the package builds, not if it works.  Note that getmaxx(window) returns
window->_maxx + 1, and similar for getmaxy.

Cheers,
       Sven

From a81cab602f5844fd9ca8efc2d391d0e1d3a85822 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Sun, 17 Dec 2023 18:07:50 +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.
---
 src/ydpdict.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/ydpdict.c b/src/ydpdict.c
index 7a6a366..97d313e 100644
--- a/src/ydpdict.c
+++ b/src/ydpdict.c
@@ -321,8 +321,8 @@ void check_size(void)
 {
 	int newx, newy, fake = 0, diff;

-	newx = stdscr->_maxx + 1;
-	newy = stdscr->_maxy + 1;
+	newx = getmaxx(stdscr);
+	newy = getmaxy(stdscr);

 	/* Minimum size */
 	if (newx < 29)
@@ -853,8 +853,8 @@ int main(int argc, char **argv)
 		switch (ch) {

 #define __MOUSE_IN(window, event, correct1, correct2, correct3, correct4) (\
-	 event.y > (window->_begy + correct1) && event.y < (window->_begy + window->_maxy + correct2) &&\
-	 event.x > (window->_begx + correct3) && event.x < (window->_begx + window->_maxx + correct4))
+	 event.y > (getbegy(window) + correct1) && event.y < (getbegy(window) + getmaxy(window) - 1 + correct2) &&\
+	 event.x > (getbegx(window) + correct3) && event.x < (getbegx(window) + getmaxx(window) - 1 + correct4))

 			case KEY_MOUSE:
 				if (getmouse(&m_event) == OK) {
@@ -885,7 +885,7 @@ int main(int argc, char **argv)
 							mvwin_wch(window_def, m_event.y - 2, x, &cc);
 							ch = cc.chars[0];
 							buf[i++] = ch;
-						} while ((iswalpha(ch) || ch == L'-') && x < window_def->_maxx);
+						} while ((iswalpha(ch) || ch == L'-') && x < getmaxx(window_def) - 1);

 						buf[--i] = L'\0';

--
2.43.0

Reply via email to