From 269325de08c2f7a3088ecc9f515933301c8d99a6 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 28 Sep 2024 20:27:44 +0000 Subject: [PATCH] snapshot of project "ncurses", label v6_5_20240928 --- NEWS | 10 +++++++++- VERSION | 2 +- dist.mk | 4 ++-- misc/gen-pkgconfig.in | 10 +++++----- misc/ncurses-config.in | 10 +++++----- ncurses/base/lib_newwin.c | 13 +++---------- ncurses/base/lib_pad.c | 8 ++++---- ncurses/base/wresize.c | 8 +++++--- ncurses/curses.priv.h | 4 +++- ncurses/tinfo/write_entry.c | 10 +++++++--- package/debian-mingw/changelog | 4 ++-- package/debian-mingw64/changelog | 4 ++-- package/debian/changelog | 4 ++-- package/mingw-ncurses.nsi | 4 ++-- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- package/ncursest.spec | 2 +- progs/infocmp.c | 32 +++++++++++++++++++++++++++----- test/back_ground.c | 4 ++-- 19 files changed, 84 insertions(+), 53 deletions(-) diff --git a/NEWS b/NEWS index 6dfb8a33..cc581e16 100644 --- a/NEWS +++ b/NEWS @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.4182 2024/09/22 20:50:07 tom Exp $ +-- $Id: NEWS,v 1.4185 2024/09/28 20:27:44 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,14 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20240928 + + improve error-message from infocmp when a terminal entry cannot be + opened (patch by Branden Robinson). + + improve filtering of -L options in misc/gen-pkgconfig.in and in + misc/ncurses-config.in + + add check in wresize() for out-of-range dimensions (report by Peter + Bierma). + 20240922 + add a few null-pointer checks in ncurses + improve test-driver in ncurses/link_test.c diff --git a/VERSION b/VERSION index d9f6bcb7..225aa120 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.5 20240922 +5:0:10 6.5 20240928 diff --git a/dist.mk b/dist.mk index 65a3c162..dd79379e 100644 --- a/dist.mk +++ b/dist.mk @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1633 2024/09/22 18:38:38 tom Exp $ +# $Id: dist.mk,v 1.1634 2024/09/28 09:53:21 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -38,7 +38,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 5 -NCURSES_PATCH = 20240922 +NCURSES_PATCH = 20240928 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/misc/gen-pkgconfig.in b/misc/gen-pkgconfig.in index 3affeefc..c369dd26 100644 --- a/misc/gen-pkgconfig.in +++ b/misc/gen-pkgconfig.in @@ -1,5 +1,5 @@ #!@SHELL@ -# $Id: gen-pkgconfig.in,v 1.57 2024/06/22 21:02:53 tom Exp $ +# $Id: gen-pkgconfig.in,v 1.58 2024/09/28 20:21:23 tom Exp $ ############################################################################## # Copyright 2018-2022,2024 Thomas E. Dickey # # Copyright 2009-2015,2018 Free Software Foundation, Inc. # @@ -112,7 +112,7 @@ do @LD_SEARCHPATH@) # skip standard libdir if [ "$lib_check" = "$libdir" ] then - lib_first=yes + lib_first=no IFS_save="$IFS" IFS='|' LIBDIRS="@LD_SEARCHPATH@" @@ -120,11 +120,11 @@ do do if [ -d "$lib_check" ] then - if [ "$lib_check" != "$libdir" ] + if [ "$lib_check" = "$libdir" ] then - lib_first=no + lib_first=yes + break fi - break fi done IFS="$IFS_save" diff --git a/misc/ncurses-config.in b/misc/ncurses-config.in index f9307d76..c671407c 100644 --- a/misc/ncurses-config.in +++ b/misc/ncurses-config.in @@ -1,5 +1,5 @@ #!@SHELL@ -# $Id: ncurses-config.in,v 1.56 2024/09/21 17:24:52 tom Exp $ +# $Id: ncurses-config.in,v 1.57 2024/09/28 20:18:19 tom Exp $ ############################################################################## # Copyright 2018-2022,2024 Thomas E. Dickey # # Copyright 2006-2015,2017 Free Software Foundation, Inc. # @@ -132,7 +132,7 @@ do @LD_SEARCHPATH@) # skip standard libdir if [ "$lib_check" = "$libdir" ] then - lib_first=yes + lib_first=no IFS_save="$IFS" IFS='|' LIBDIRS="@LD_SEARCHPATH@" @@ -140,11 +140,11 @@ do do if [ -d "$lib_check" ] then - if [ "$lib_check" != "$libdir" ] + if [ "$lib_check" = "$libdir" ] then - lib_first=no + lib_first=yes + break fi - break fi done IFS="$IFS_save" diff --git a/ncurses/base/lib_newwin.c b/ncurses/base/lib_newwin.c index a6723197..ef9da926 100644 --- a/ncurses/base/lib_newwin.c +++ b/ncurses/base/lib_newwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -44,7 +44,7 @@ #include #include -MODULE_ID("$Id: lib_newwin.c,v 1.76 2021/10/23 18:53:38 tom Exp $") +MODULE_ID("$Id: lib_newwin.c,v 1.77 2024/09/28 15:55:56 tom Exp $") #define window_is(name) ((sp)->_##name == win) @@ -255,13 +255,6 @@ subwin(WINDOW *w, int l, int c, int y, int x) returnWin(result); } -static bool -dimension_limit(int value) -{ - NCURSES_SIZE_T test = (NCURSES_SIZE_T) value; - return (test == value && value > 0); -} - NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_DCLx int num_lines, @@ -281,7 +274,7 @@ NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_DCLx if (SP_PARM == 0) returnWin(0); - if (!dimension_limit(num_lines) || !dimension_limit(num_columns)) + if (!OK_DIMENSION(num_lines) || !OK_DIMENSION(num_columns)) returnWin(0); if ((wp = typeCalloc(WINDOWLIST, 1)) == 0) diff --git a/ncurses/base/lib_pad.c b/ncurses/base/lib_pad.c index d4bd7f11..10ac5372 100644 --- a/ncurses/base/lib_pad.c +++ b/ncurses/base/lib_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_pad.c,v 1.50 2021/10/23 22:57:27 tom Exp $") +MODULE_ID("$Id: lib_pad.c,v 1.51 2024/09/28 15:40:42 tom Exp $") NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (NCURSES_SP_DCLx int l, int c) @@ -197,8 +197,8 @@ pnoutrefresh(WINDOW *win, #endif /* TRACE */ #if USE_SCROLL_HINTS if (win->_pad._pad_y >= 0) { - displaced = pminrow - win->_pad._pad_y - - (sminrow - win->_pad._pad_top); + displaced = ((pminrow - win->_pad._pad_y) - + (sminrow - win->_pad._pad_top)); T(("pad being shifted by %d line(s)", displaced)); } else displaced = 0; diff --git a/ncurses/base/wresize.c b/ncurses/base/wresize.c index 6d5589e2..576efa52 100644 --- a/ncurses/base/wresize.c +++ b/ncurses/base/wresize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2023 Thomas E. Dickey * + * Copyright 2019-2023,2024 Thomas E. Dickey * * Copyright 1998-2010,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -34,7 +34,7 @@ #include -MODULE_ID("$Id: wresize.c,v 1.43 2023/10/21 11:13:03 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.44 2024/09/28 15:56:07 tom Exp $") static int cleanup_lines(struct ldat *data, int length) @@ -125,9 +125,11 @@ wresize(WINDOW *win, int ToLines, int ToCols) } #endif - if (!win || --ToLines < 0 || --ToCols < 0) + if (!win || !OK_DIMENSION(ToLines) || !OK_DIMENSION(ToCols)) returnCode(ERR); + ToLines--; + ToCols--; size_x = win->_maxx; size_y = win->_maxy; diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 2d579b6c..9a549c11 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -35,7 +35,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.690 2024/08/31 10:46:01 Rafael.Kitover Exp $ + * $Id: curses.priv.h,v 1.691 2024/09/28 15:35:01 tom Exp $ * * curses.priv.h * @@ -1550,6 +1550,8 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; ((x) >= 0 && (x) <= (w)->_maxx && \ (y) >= 0 && (y) <= (w)->_maxy)) +#define OK_DIMENSION(n) ((NCURSES_SIZE_T)(n) == (n) && (n) > 0) + #define CHANGED_CELL(line,col) \ if (line->firstchar == _NOCHANGE) \ line->firstchar = line->lastchar = (NCURSES_SIZE_T) (col); \ diff --git a/ncurses/tinfo/write_entry.c b/ncurses/tinfo/write_entry.c index df62a7a0..afe703b2 100644 --- a/ncurses/tinfo/write_entry.c +++ b/ncurses/tinfo/write_entry.c @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: write_entry.c,v 1.134 2024/08/31 10:46:01 Rafael.Kitover Exp $") +MODULE_ID("$Id: write_entry.c,v 1.135 2024/09/28 17:31:09 tom Exp $") #if 1 #define TRACE_OUT(p) DEBUG(2, p) @@ -153,8 +153,12 @@ make_db_path(char *dst, const char *src, size_t limit) rc = 0; } } else { - if ((strlen(top) + strlen(src) + 6) <= limit) { - _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%s/%s", top, src); + size_t len_top = strlen(top); + size_t len_src = strlen(src); + if ((len_top + len_src + 6) <= limit) { + _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%.*s/%.*s", + (int) len_top, top, + (int) len_src, src); rc = 0; } } diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 72d8f0d7..5651c339 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6td (6.5+20240922) unstable; urgency=low +ncurses6td (6.5+20240928) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 22 Sep 2024 14:38:38 -0400 + -- Thomas E. Dickey Sat, 28 Sep 2024 05:53:21 -0400 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 72d8f0d7..5651c339 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6td (6.5+20240922) unstable; urgency=low +ncurses6td (6.5+20240928) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 22 Sep 2024 14:38:38 -0400 + -- Thomas E. Dickey Sat, 28 Sep 2024 05:53:21 -0400 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index d26a574a..069f31a9 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6td (6.5+20240922) unstable; urgency=low +ncurses6td (6.5+20240928) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 22 Sep 2024 14:38:38 -0400 + -- Thomas E. Dickey Sat, 28 Sep 2024 05:53:21 -0400 ncurses6 (5.9+20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index cf437074..ac2f6bdf 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.668 2024/09/22 18:38:38 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.669 2024/09/28 09:53:21 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "5" !define VERSION_YYYY "2024" -!define VERSION_MMDD "0922" +!define VERSION_MMDD "0928" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 54175e2a..085d645d 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.5 -Release: 20240922 +Release: 20240928 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncurses.spec b/package/ncurses.spec index fbffe01f..1ae4700d 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.5 -Release: 20240922 +Release: 20240928 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncursest.spec b/package/ncursest.spec index 54aa4ca8..f78c4497 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.5 -Release: 20240922 +Release: 20240928 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/progs/infocmp.c b/progs/infocmp.c index af2ad779..e0621bc0 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.164 2024/08/24 22:57:24 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.165 2024/09/28 20:26:22 Branden.Robinson Exp $") #ifndef ACTUAL_TIC #define ACTUAL_TIC "tic" @@ -1878,10 +1878,32 @@ main(int argc, char *argv[]) } if (status <= 0) { - (void) fprintf(stderr, - "%s: couldn't open terminfo file %s.\n", - _nc_progname, - tfile[termcount]); + switch (status) { + case TGETENT_NO: + (void) fprintf(stderr, + "%s: error: no match in terminfo" + " database for terminal type" + " \"%s\"\n", + _nc_progname, + tname[termcount]); + break; + case TGETENT_ERR: + /* + * Several database files might be checked; their + * file names are not exposed via this API. The + * best we can do is report how the final one + * attempted failed. Also, tfile[termcount] is + * deeply misleading when a hashed database is used. + */ + (void) fprintf(stderr, + "%s: error: unable to open terminfo" + " database: %s\n", + _nc_progname, + strerror(errno)); + break; + default: + assert(0 == "unhandled _nc_read_entry2 return"); + } MAIN_LEAKS(); ExitProgram(EXIT_FAILURE); } diff --git a/test/back_ground.c b/test/back_ground.c index 04f4304e..bc866a1a 100644 --- a/test/back_ground.c +++ b/test/back_ground.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: back_ground.c,v 1.11 2024/09/22 21:33:17 tom Exp $ + * $Id: back_ground.c,v 1.12 2024/09/28 16:19:19 tom Exp $ */ #include @@ -233,7 +233,7 @@ main(int argc, char *argv[]) usage(FALSE); fill_char = (wchar_t) value; } else { - fill_char = *optarg; + fill_char = (wchar_t) *optarg; } break; #if HAVE_USE_DEFAULT_COLORS