mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 00:20:38 -09:00
ncurses from 6.4.20231021 enables "NCUSES_OPAQUE_MENU", which hides
some parts of the code away from the application. This causes
petitboot to fail building in a few spots where it tries to directly
access the name of the menu item.
Since the ncurses package was bumped to version 6.5.20250517 in
commit [0], petitboot is failing to build with error:
ui/ncurses/nc-menu.h: In function ‘pmenu_dump_item’:
ui/ncurses/nc-menu.h:129:47: error: invalid use of incomplete typedef ‘ITEM’ {aka ‘const struct tagITEM’}
129 | pb_debug("%p %s\n", item, (item ? item->name.str : "(null)"));
This commit fixes the issue by adding package patches.
These two patches were submitted to the petitboot mailing list by
Nicholas Piggin [1] resolve this issue using accessors, or by making a new item.
This has been raised upstream but not yet applied [2].
[0]: e7c091f113
[1]: https://lists.ozlabs.org/pipermail/petitboot/2024-February/thread.html#1545
[2]: https://github.com/open-power/petitboot/issues/106
Signed-off-by: Nathaniel Roach <nroach44@nroach44.id.au>
Fixes: https://autobuild.buildroot.org/results/bf1/bf173e1e0f8ad3f40534aaa358dc40993cd14ac4/build-end.log
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
[Julien:
- add Signed-off-by in patches
- add info in commit log
]
Signed-off-by: Julien Olivain <ju.o@free.fr>
68 lines
2.0 KiB
Diff
68 lines
2.0 KiB
Diff
Recent Debian ncurses is built with NCURSES_OPAQUE_MENU, which means
|
|
the menu item type can't be poked directly. Fix with accessors.
|
|
|
|
One wrinkle is the item name can't be modified, new_item has to be used.
|
|
|
|
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
|
|
Upstream: https://github.com/open-power/petitboot/issues/106
|
|
Signed-off-by: Nathaniel Roach <nroach44@nroach44.id.au>
|
|
---
|
|
ui/ncurses/nc-menu.c | 12 ++++++++----
|
|
ui/ncurses/nc-menu.h | 4 ++--
|
|
2 files changed, 10 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/ui/ncurses/nc-menu.c b/ui/ncurses/nc-menu.c
|
|
index a90a02e..a1524b5 100644
|
|
--- a/ui/ncurses/nc-menu.c
|
|
+++ b/ui/ncurses/nc-menu.c
|
|
@@ -141,9 +141,13 @@ int pmenu_item_update(struct pmenu_item *item, const char *name)
|
|
if (!label)
|
|
return -1;
|
|
|
|
- i = item->nci;
|
|
- i->name.str = label;
|
|
- i->name.length = strncols(label);
|
|
+ i = new_item(label, NULL);
|
|
+ if (!i) {
|
|
+ talloc_free((char *)label);
|
|
+ return -1;
|
|
+ }
|
|
+ free_item(item->nci);
|
|
+ item->nci = i;
|
|
|
|
return 0;
|
|
}
|
|
@@ -358,7 +362,7 @@ static int pmenu_item_get_index(const struct pmenu_item *item)
|
|
return i;
|
|
|
|
pb_log_fn("not found: %p %s\n", item,
|
|
- (item ? item->nci->name.str : "(null)"));
|
|
+ (item ? item_name(item->nci) : "(null)"));
|
|
return -1;
|
|
}
|
|
|
|
diff --git a/ui/ncurses/nc-menu.h b/ui/ncurses/nc-menu.h
|
|
index eb568c8..550c7e1 100644
|
|
--- a/ui/ncurses/nc-menu.h
|
|
+++ b/ui/ncurses/nc-menu.h
|
|
@@ -126,7 +126,7 @@ static inline struct pmenu *pmenu_from_scr(struct nc_scr *scr)
|
|
|
|
static inline void pmenu_dump_item(const ITEM *item)
|
|
{
|
|
- pb_debug("%p %s\n", item, (item ? item->name.str : "(null)"));
|
|
+ pb_debug("%p %s\n", item, (item ? item_name(item) : "(null)"));
|
|
}
|
|
|
|
static inline void pmenu_dump_items(ITEM *const *items, unsigned int count)
|
|
@@ -135,7 +135,7 @@ static inline void pmenu_dump_items(ITEM *const *items, unsigned int count)
|
|
|
|
for (i = 0; i < count; i++)
|
|
pb_debug("%u: %p %s\n", i, items[i],
|
|
- (items[i] ? items[i]->name.str : "(null)"));
|
|
+ (items[i] ? item_name(items[i]) : "(null)"));
|
|
}
|
|
|
|
#endif
|
|
--
|
|
2.42.0
|