gh-154055: Gate optional curses functions absent on old SVr4 curses#154057
Merged
serhiy-storchaka merged 1 commit intoJul 19, 2026
Conversation
…rses Build hygiene so the curses modules build against a limited curses (e.g. the native SVr4 curses of illumos/Solaris), matching how other optional functions are already gated: * Probe and #ifdef-gate the X/Open attr_t functions (window.attr_get/attr_set/ attr_on/attr_off/color_set), the soft-label attribute functions (slk_attr_on/off/set, slk_color) and scr_set(); scr_set is probed separately from the scr_dump family, which SVr4 has without it. * Stop gating update_lines_cols() on resizeterm(): it only reads LINES/COLS and is used unconditionally (e.g. by set_term()), so a build without resizeterm() failed to link. * On Solaris/illumos define _BOOL (and include <stdbool.h>) so the SVr4 <curses.h> "typedef char bool" does not clash with C's bool. test.test_curses: skip or guard the tests that use the now-optional functions, split test_attributes so its chtype-based part still runs, and treat the native curses of NetBSD and illumos/Solaris as having broken newterm() (they crash on repeated newterm()/delscreen(), like ncurses before 6.5). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
serhiy-storchaka
requested review from
AA-Turner,
corona10,
emmatyping,
erlend-aasland and
itamaro
as code owners
July 19, 2026 07:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modules/_cursesmodule.cused several optional functions unconditionally, so the module failed to build against a limited curses such as the native SVr4 curses of illumos/Solaris. Probe and#ifdef-gate them, matching how the other optional functions (is_pad,resizeterm, …) are already handled:attr_tfunctions behindwindow.attr_get/attr_set/attr_on/attr_off/color_set,slk_attr_on/slk_attr_off/slk_attr_set/slk_color,scr_set()— probed separately fromscr_dump/scr_restore/scr_init, which SVr4 has without it.Two related fixes:
update_lines_cols()was compiled only underHAVE_CURSES_RESIZETERM/HAVE_CURSES_RESIZE_TERMbut is used unconditionally (e.g. byset_term()), so a curses withoutresizeterm()failed to link._BOOL(and include<stdbool.h>) so the SVr4<curses.h>typedef char booldoes not clash with C'sbool.test.test_cursesskips or guards the tests that use the now-optional functions (splittingtest_attributesso its chtype-based part still runs), and treats the native curses of NetBSD and illumos/Solaris as having a brokennewterm()— they crash on repeatednewterm()/delscreen(), like ncurses before 6.5.Verified: no change on ncursesw (all present); on illumos SVr4
--with-curses=cursesnow builds, imports, and runstest_curseswithout crashing (remaining failures are SVr4 behavioural divergences).