From 3f57ad09dfcb62c8ad444e13fa4d450c05e878ba Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 9 Jul 2022 22:51:27 +0000 Subject: [PATCH] ncurses 6.3 - patch 20220709 + lock the prescreen data consistently in newterm, etc., for the pthreads configuration (report by Tom de Vries). --- NEWS | 6 +++++- VERSION | 2 +- dist.mk | 4 ++-- ncurses/base/lib_newterm.c | 7 +++++-- ncurses/base/lib_set_term.c | 10 ++++++++-- ncurses/base/lib_slkinit.c | 7 +++++-- ncurses/tinfo/lib_data.c | 25 ++++++++++++++----------- ncurses/tinfo/lib_setup.c | 6 ++++-- 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 +- test/worm.c | 18 ++++-------------- 16 files changed, 59 insertions(+), 48 deletions(-) diff --git a/NEWS b/NEWS index b3d46cbb..e4b391fb 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.3826 2022/07/03 22:22:14 tom Exp $ +-- $Id: NEWS,v 1.3828 2022/07/09 22:07:08 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. +20220709 + + lock the prescreen data consistently in newterm, etc., for the + pthreads configuration (report by Tom de Vries). + 20220703 + add consistency check in tic for u6/u7/u8/u9 and NQ capabilities. + use NQ to flag entries where the terminal does not support query and diff --git a/VERSION b/VERSION index 79a301f6..a8abfcce 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.3 20220703 +5:0:10 6.3 20220709 diff --git a/dist.mk b/dist.mk index 2b2a93f6..78bec51b 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.1490 2022/07/03 20:03:28 tom Exp $ +# $Id: dist.mk,v 1.1491 2022/07/09 12:55:00 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 = 3 -NCURSES_PATCH = 20220703 +NCURSES_PATCH = 20220709 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/base/lib_newterm.c b/ncurses/base/lib_newterm.c index bba97ba1..15d05a31 100644 --- a/ncurses/base/lib_newterm.c +++ b/ncurses/base/lib_newterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2020,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,7 +49,7 @@ #include -MODULE_ID("$Id: lib_newterm.c,v 1.103 2020/09/05 21:34:04 tom Exp $") +MODULE_ID("$Id: lib_newterm.c,v 1.104 2022/07/09 18:58:58 tom Exp $") #ifdef USE_TERM_DRIVER #define NumLabels InfoOf(SP_PARM).numlabels @@ -362,11 +362,14 @@ NCURSES_EXPORT(SCREEN *) newterm(const char *name, FILE *ofp, FILE *ifp) { SCREEN *rc; + + _nc_init_pthreads(); _nc_lock_global(prescreen); START_TRACE(); rc = NCURSES_SP_NAME(newterm) (CURRENT_SCREEN_PRE, name, ofp, ifp); _nc_forget_prescr(); _nc_unlock_global(prescreen); + return rc; } #endif diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c index 264fb98e..2d28b751 100644 --- a/ncurses/base/lib_set_term.c +++ b/ncurses/base/lib_set_term.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -54,7 +54,7 @@ #undef CUR #define CUR SP_TERMTYPE -MODULE_ID("$Id: lib_set_term.c,v 1.179 2021/05/08 21:48:34 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.180 2022/07/09 18:58:58 tom Exp $") #ifdef USE_TERM_DRIVER #define MaxColors InfoOf(sp).maxcolors @@ -819,10 +819,13 @@ NCURSES_EXPORT(int) _nc_ripoffline(int line, int (*init) (WINDOW *, int)) { int rc; + + _nc_init_pthreads(); _nc_lock_global(prescreen); START_TRACE(); rc = NCURSES_SP_NAME(_nc_ripoffline) (CURRENT_SCREEN_PRE, line, init); _nc_unlock_global(prescreen); + return rc; } #endif @@ -843,10 +846,13 @@ NCURSES_EXPORT(int) ripoffline(int line, int (*init) (WINDOW *, int)) { int rc; + + _nc_init_pthreads(); _nc_lock_global(prescreen); START_TRACE(); rc = NCURSES_SP_NAME(ripoffline) (CURRENT_SCREEN_PRE, line, init); _nc_unlock_global(prescreen); + return rc; } #endif diff --git a/ncurses/base/lib_slkinit.c b/ncurses/base/lib_slkinit.c index e1602abc..318077fc 100644 --- a/ncurses/base/lib_slkinit.c +++ b/ncurses/base/lib_slkinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2022 Thomas E. Dickey * * Copyright 1998-2009,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,7 +41,7 @@ */ #include -MODULE_ID("$Id: lib_slkinit.c,v 1.15 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_slkinit.c,v 1.16 2022/07/09 18:58:58 tom Exp $") #ifdef USE_SP_RIPOFF #define SoftkeyFormat SP_PARM->slk_format @@ -77,10 +77,13 @@ NCURSES_EXPORT(int) slk_init(int format) { int rc; + + _nc_init_pthreads(); _nc_lock_global(prescreen); START_TRACE(); rc = NCURSES_SP_NAME(slk_init) (CURRENT_SCREEN_PRE, format); _nc_unlock_global(prescreen); + return rc; } #endif diff --git a/ncurses/tinfo/lib_data.c b/ncurses/tinfo/lib_data.c index baaa67be..6f6c583a 100644 --- a/ncurses/tinfo/lib_data.c +++ b/ncurses/tinfo/lib_data.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,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_data.c,v 1.86 2021/11/20 23:14:34 tom Exp $") +MODULE_ID("$Id: lib_data.c,v 1.87 2022/07/09 22:03:21 tom Exp $") /* * OS/2's native linker complains if we don't initialize public data when @@ -363,25 +363,28 @@ _nc_mutex_init(pthread_mutex_t * obj) NCURSES_EXPORT(int) _nc_mutex_lock(pthread_mutex_t * obj) { - if (_nc_use_pthreads == 0) - return 0; - return pthread_mutex_lock(obj); + int rc = 0; + if (_nc_use_pthreads != 0) + rc = pthread_mutex_lock(obj); + return rc; } NCURSES_EXPORT(int) _nc_mutex_trylock(pthread_mutex_t * obj) { - if (_nc_use_pthreads == 0) - return 0; - return pthread_mutex_trylock(obj); + int rc = 0; + if (_nc_use_pthreads != 0) + rc = pthread_mutex_trylock(obj); + return rc; } NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t * obj) { - if (_nc_use_pthreads == 0) - return 0; - return pthread_mutex_unlock(obj); + int rc = 0; + if (_nc_use_pthreads != 0) + rc = pthread_mutex_unlock(obj); + return rc; } #endif /* USE_PTHREADS */ diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index 434d5633..5ed47409 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,7 +49,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.215 2021/11/20 23:11:31 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.216 2022/07/09 18:58:58 tom Exp $") /**************************************************************************** * @@ -990,6 +990,7 @@ _nc_setupterm(const char *tname, int rc = ERR; TERMINAL *termp = 0; + _nc_init_pthreads(); _nc_lock_global(prescreen); START_TRACE(); if (TINFO_SETUP_TERM(&termp, tname, Filedes, errret, reuse) == OK) { @@ -999,6 +1000,7 @@ _nc_setupterm(const char *tname, } } _nc_unlock_global(prescreen); + return rc; } #endif diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index c9b079e6..e7d1eabd 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220703) unstable; urgency=low +ncurses6 (6.3+20220709) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 03 Jul 2022 16:03:28 -0400 + -- Thomas E. Dickey Sat, 09 Jul 2022 08:55:00 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index c9b079e6..e7d1eabd 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220703) unstable; urgency=low +ncurses6 (6.3+20220709) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 03 Jul 2022 16:03:28 -0400 + -- Thomas E. Dickey Sat, 09 Jul 2022 08:55:00 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index d42c94da..2cd4ba60 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220703) unstable; urgency=low +ncurses6 (6.3+20220709) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 03 Jul 2022 16:03:28 -0400 + -- Thomas E. Dickey Sat, 09 Jul 2022 08:55:00 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 7c9faa0b..3515f090 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.530 2022/07/03 20:03:28 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.531 2022/07/09 12:55:00 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "3" !define VERSION_YYYY "2022" -!define VERSION_MMDD "0703" +!define VERSION_MMDD "0709" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index cfe4807f..1b449e82 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.3 -Release: 20220703 +Release: 20220709 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 76ded985..ad7da53b 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.3 -Release: 20220703 +Release: 20220709 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index e81ce017..efc86cc9 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.3 -Release: 20220703 +Release: 20220709 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/test/worm.c b/test/worm.c index 6304e4b0..ab1eb9fa 100644 --- a/test/worm.c +++ b/test/worm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2018-2020,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -53,7 +53,7 @@ traces will be dumped. The program stops and waits for one character of input at the beginning and end of the interval. - $Id: worm.c,v 1.82 2020/02/02 23:34:34 tom Exp $ + $Id: worm.c,v 1.83 2022/07/09 20:51:25 tom Exp $ */ #include @@ -350,11 +350,7 @@ start_worm(void *arg) while (!quit_worm((int) (((struct worm *) arg) - worm))) { while (compare < sequence) { ++compare; -#if HAVE_USE_WINDOW - use_window(stdscr, draw_worm, arg); -#else - draw_worm(stdscr, arg); -#endif + USING_WINDOW2(stdscr, draw_worm, arg); } } Trace(("...start_worm (done)")); @@ -379,13 +375,7 @@ draw_all_worms(void) } #else for (n = 0, w = &worm[0]; n < number; n++, w++) { - if ( -#if HAVE_USE_WINDOW - USING_WINDOW2(stdscr, draw_worm, w) -#else - draw_worm(stdscr, w) -#endif - ) + if (USING_WINDOW2(stdscr, draw_worm, w)) done = TRUE; } #endif -- 2.44.0