From 515d83a2495606171a23c6eee948aea07536d178 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 25 Jun 2023 23:46:35 +0000 Subject: [PATCH] ncurses 6.4 - patch 20230625 + adjust man/make_sed.sh to work with dates as the third field of TH. + fixes for out-of-memory condition (report by "eaglegai"). --- NEWS | 6 +++++- VERSION | 2 +- dist.mk | 4 ++-- man/make_sed.sh | 8 +++---- ncurses/tinfo/obsolete.c | 20 ++++++++++------- ncurses/tty/hardscroll.c | 37 +++++++++++++++++++------------- ncurses/tty/hashmap.c | 9 +++++--- 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 +- 14 files changed, 63 insertions(+), 45 deletions(-) diff --git a/NEWS b/NEWS index dd032a57..1e3e9f5d 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.3969 2023/06/24 22:59:35 tom Exp $ +-- $Id: NEWS,v 1.3971 2023/06/25 18:16:49 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,10 @@ 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. +20230625 + + adjust man/make_sed.sh to work with dates as the third field of TH. + + fixes for out-of-memory condition (report by "eaglegai"). + 20230624 + fixes for out-of-memory condition (report by "eaglegai"). diff --git a/VERSION b/VERSION index 87165874..9a883773 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.4 20230624 +5:0:10 6.4 20230625 diff --git a/dist.mk b/dist.mk index 999e3468..18492151 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.1551 2023/06/24 10:06:22 tom Exp $ +# $Id: dist.mk,v 1.1552 2023/06/25 09:41: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 = 4 -NCURSES_PATCH = 20230624 +NCURSES_PATCH = 20230625 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/man/make_sed.sh b/man/make_sed.sh index 2a290f0b..2b9ea9f5 100755 --- a/man/make_sed.sh +++ b/man/make_sed.sh @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: make_sed.sh,v 1.16 2022/10/01 13:14:07 tom Exp $ +# $Id: make_sed.sh,v 1.17 2023/06/25 18:13:17 tom Exp $ ############################################################################## -# Copyright 2020-2021,2022 Thomas E. Dickey # +# Copyright 2020-2022,2023 Thomas E. Dickey # # Copyright 1998-2005,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -69,9 +69,9 @@ sed -e 's/^/s\/\\ -MODULE_ID("$Id: obsolete.c,v 1.9 2023/06/24 22:02:25 tom Exp $") +MODULE_ID("$Id: obsolete.c,v 1.10 2023/06/25 16:56:27 tom Exp $") /* * Obsolete entrypoint retained for binary compatibility. @@ -252,6 +252,8 @@ _nc_conv_to_utf32(unsigned *target, const char *source, unsigned limit) #undef free #undef strdup +#define TR_OOM(stmt) T(stmt) + static long oom_limit = -1; static long oom_count = 0; @@ -272,11 +274,12 @@ oom_check(void) oom_limit = 0; } } + ++oom_count; if (oom_limit >= 0) { - result = (++oom_count > oom_limit); + result = (oom_count > oom_limit); if (result && !triggered) { triggered = TRUE; - T(("out-of-memory")); + TR_OOM(("out-of-memory")); } } return result; @@ -288,7 +291,7 @@ _nc_oom_malloc(size_t size) char *result = (oom_check() ? NULL : malloc(size)); - T(("oom #%ld malloc(%ld) %p", oom_count, size, result)); + TR_OOM(("oom #%ld malloc(%ld) %p", oom_count, size, result)); return result; } @@ -298,7 +301,7 @@ _nc_oom_calloc(size_t nmemb, size_t size) char *result = (oom_check() ? NULL : calloc(nmemb, size)); - T(("oom #%ld calloc(%ld, %ld) %p", oom_count, nmemb, size, result)); + TR_OOM(("oom #%ld calloc(%ld, %ld) %p", oom_count, nmemb, size, result)); return result; } @@ -308,14 +311,15 @@ _nc_oom_realloc(void *ptr, size_t size) char *result = (oom_check() ? NULL : realloc(ptr, size)); - T(("oom #%ld realloc(%p, %ld) %p", oom_count, ptr, size, result)); + TR_OOM(("oom #%ld realloc(%p, %ld) %p", oom_count, ptr, size, result)); return result; } NCURSES_EXPORT(void) _nc_oom_free(void *ptr) { - T(("oom #%ld free(%p)", oom_count, ptr)); + ++oom_count; + TR_OOM(("oom #%ld free(%p)", oom_count, ptr)); free(ptr); } @@ -325,7 +329,7 @@ _nc_oom_strdup(const char *ptr) char *result = (oom_check() ? NULL : strdup(ptr)); - T(("oom #%ld strdup(%p) %p", oom_count, ptr, result)); + TR_OOM(("oom #%ld strdup(%p) %p", oom_count, ptr, result)); return result; } #endif /* EXP_OOM_TESTING */ diff --git a/ncurses/tty/hardscroll.c b/ncurses/tty/hardscroll.c index d66aa994..0c194b46 100644 --- a/ncurses/tty/hardscroll.c +++ b/ncurses/tty/hardscroll.c @@ -148,7 +148,7 @@ AUTHOR #include -MODULE_ID("$Id: hardscroll.c,v 1.56 2023/06/24 22:55:24 tom Exp $") +MODULE_ID("$Id: hardscroll.c,v 1.57 2023/06/25 15:39:32 tom Exp $") #if defined(SCROLLDEBUG) || defined(HASHDEBUG) @@ -307,20 +307,27 @@ NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_linedump) (NCURSES_SP_DCL0) /* dump the state of the real and virtual oldnum fields */ { - char *buf = 0; - size_t want = ((size_t) screen_lines(SP_PARM) + 1) * 4; - (void) SP_PARM; - - if ((buf = typeMalloc(char, want)) != 0) { - int n; - - *buf = '\0'; - for (n = 0; n < screen_lines(SP_PARM); n++) - _nc_SPRINTF(buf + strlen(buf), - _nc_SLIMIT(want - strlen(buf)) - " %02d", OLDNUM(SP_PARM, n)); - TR(TRACE_UPDATE | TRACE_MOVE, ("virt %s", buf)); - free(buf); + if (USE_TRACEF(TRACE_UPDATE | TRACE_MOVE)) { + char *buf = 0; + size_t want = ((size_t) screen_lines(SP_PARM) + 1) * 4; + (void) SP_PARM; + + if ((buf = typeMalloc(char, want)) != 0) { + int n; + + *buf = '\0'; + for (n = 0; n < screen_lines(SP_PARM); n++) { + int number = OLDNUM(SP_PARM, n); + if (number >= -99 && number < 999) { + _nc_SPRINTF(buf + strlen(buf), + _nc_SLIMIT(want - strlen(buf)) + " %02d", number); + } else { + strcat(buf, " ??"); + } + } + free(buf); + } } } diff --git a/ncurses/tty/hashmap.c b/ncurses/tty/hashmap.c index 3f124c96..2ddfaaa2 100644 --- a/ncurses/tty/hashmap.c +++ b/ncurses/tty/hashmap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 2019-2020,2023 Thomas E. Dickey * * Copyright 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -74,7 +74,7 @@ AUTHOR #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: hashmap.c,v 1.69 2020/05/31 17:50:48 tom Exp $") +MODULE_ID("$Id: hashmap.c,v 1.70 2023/06/25 17:16:01 tom Exp $") #ifdef HASHDEBUG @@ -318,8 +318,11 @@ NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0) if (newhash(SP_PARM) == 0) newhash(SP_PARM) = typeCalloc(unsigned long, (size_t) screen_lines(SP_PARM)); - if (!oldhash(SP_PARM) || !newhash(SP_PARM)) + if (!oldhash(SP_PARM) || !newhash(SP_PARM)) { + FreeAndNull(oldhash(SP_PARM)); + FreeAndNull(newhash(SP_PARM)); return; /* malloc failure */ + } for (i = 0; i < screen_lines(SP_PARM); i++) { newhash(SP_PARM)[i] = hash(SP_PARM, NEWTEXT(SP_PARM, i)); oldhash(SP_PARM)[i] = hash(SP_PARM, OLDTEXT(SP_PARM, i)); diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 4356b0eb..0b91e886 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20230624) unstable; urgency=low +ncurses6 (6.4+20230625) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 24 Jun 2023 06:06:22 -0400 + -- Thomas E. Dickey Sun, 25 Jun 2023 05:41:21 -0400 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 4356b0eb..0b91e886 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20230624) unstable; urgency=low +ncurses6 (6.4+20230625) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 24 Jun 2023 06:06:22 -0400 + -- Thomas E. Dickey Sun, 25 Jun 2023 05:41:21 -0400 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index 8783d4d0..f563a328 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20230624) unstable; urgency=low +ncurses6 (6.4+20230625) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 24 Jun 2023 06:06:22 -0400 + -- Thomas E. Dickey Sun, 25 Jun 2023 05:41:21 -0400 ncurses6 (5.9+20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 7abb6160..fdadc5a7 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.591 2023/06/24 10:06:22 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.592 2023/06/25 09:41:21 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "4" !define VERSION_YYYY "2023" -!define VERSION_MMDD "0624" +!define VERSION_MMDD "0625" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 82240292..e6f9b8b4 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.4 -Release: 20230624 +Release: 20230625 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncurses.spec b/package/ncurses.spec index 8b541eea..6ebb0e66 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.4 -Release: 20230624 +Release: 20230625 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncursest.spec b/package/ncursest.spec index dc459b77..a6e6db08 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.4 -Release: 20230624 +Release: 20230625 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz -- 2.45.0