From 3ffedbf1016b2d7026e7543fe73e87b046fbd862 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 17 Sep 2022 23:40:53 +0000 Subject: [PATCH] ncurses 6.3 - patch 20220917 + reduce memory-leak in tic by separating allocations for struct entry from TERMTYPE2 (cf: 20220430). + improve interaction between tic -v option and NCURSES_TRACE, by processing the latter only when -v option does not set _nc_tracing. + modify curses_trace() to show the trace-mask as symbols, e.g., TRACE_ORDINARY, DEBUG_LEVEL(3). --- NEWS | 10 +++++- VERSION | 2 +- dist.mk | 4 +-- doc/html/man/adacurses6-config.1.html | 2 +- doc/html/man/captoinfo.1m.html | 2 +- doc/html/man/clear.1.html | 2 +- doc/html/man/form.3x.html | 2 +- doc/html/man/infocmp.1m.html | 2 +- doc/html/man/infotocap.1m.html | 2 +- doc/html/man/menu.3x.html | 2 +- doc/html/man/ncurses.3x.html | 2 +- doc/html/man/ncurses6-config.1.html | 2 +- doc/html/man/panel.3x.html | 2 +- doc/html/man/tabs.1.html | 2 +- doc/html/man/terminfo.5.html | 2 +- doc/html/man/tic.1m.html | 38 ++++++++++++-------- doc/html/man/toe.1m.html | 2 +- doc/html/man/tput.1.html | 2 +- doc/html/man/tset.1.html | 2 +- include/tic.h | 4 +-- man/tic.1m | 24 +++++++++---- ncurses/tinfo/alloc_entry.c | 51 ++++++++++++++++++++++++--- ncurses/tinfo/alloc_ttype.c | 10 +++--- ncurses/tinfo/comp_parse.c | 5 +-- ncurses/trace/lib_trace.c | 45 ++++++++++++++++++++++- 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/progs.priv.h | 20 ++++++++--- progs/tic.c | 21 +++++++++-- 34 files changed, 214 insertions(+), 72 deletions(-) diff --git a/NEWS b/NEWS index 5fdefda4..241c6188 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.3856 2022/09/10 22:31:34 tom Exp $ +-- $Id: NEWS,v 1.3858 2022/09/17 20:49:10 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. +20220917 + + reduce memory-leak in tic by separating allocations for struct entry + from TERMTYPE2 (cf: 20220430). + + improve interaction between tic -v option and NCURSES_TRACE, by + processing the latter only when -v option does not set _nc_tracing. + + modify curses_trace() to show the trace-mask as symbols, e.g., + TRACE_ORDINARY, DEBUG_LEVEL(3). + 20220910 + amend verbose-option change to make this affect level 3, e.g., using "tic -cv3 terminfo". diff --git a/VERSION b/VERSION index 0dbd28c3..cecc2752 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.3 20220910 +5:0:10 6.3 20220917 diff --git a/dist.mk b/dist.mk index a3ebf740..3f682b53 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.1501 2022/09/10 09:26:46 tom Exp $ +# $Id: dist.mk,v 1.1502 2022/09/17 10:53:30 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 = 20220910 +NCURSES_PATCH = 20220917 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/doc/html/man/adacurses6-config.1.html b/doc/html/man/adacurses6-config.1.html index 28a543dc..02eb5eb5 100644 --- a/doc/html/man/adacurses6-config.1.html +++ b/doc/html/man/adacurses6-config.1.html @@ -126,7 +126,7 @@

SEE ALSO

        curses(3x)
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/doc/html/man/captoinfo.1m.html b/doc/html/man/captoinfo.1m.html
index 8f78a276..baec5d30 100644
--- a/doc/html/man/captoinfo.1m.html
+++ b/doc/html/man/captoinfo.1m.html
@@ -199,7 +199,7 @@
 

SEE ALSO

        infocmp(1m), curses(3x), terminfo(5)
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 

AUTHOR

diff --git a/doc/html/man/clear.1.html b/doc/html/man/clear.1.html
index 8e13a37c..f9ebf2d7 100644
--- a/doc/html/man/clear.1.html
+++ b/doc/html/man/clear.1.html
@@ -150,7 +150,7 @@
 

SEE ALSO

        tput(1), terminfo(5), xterm(1).
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/doc/html/man/form.3x.html b/doc/html/man/form.3x.html
index c0eadee0..21021e2a 100644
--- a/doc/html/man/form.3x.html
+++ b/doc/html/man/form.3x.html
@@ -248,7 +248,7 @@
        curses(3x) and related pages whose names  begin  "form_"  for  detailed
        descriptions of the entry points.
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/doc/html/man/infocmp.1m.html b/doc/html/man/infocmp.1m.html
index e528651b..c5d240a1 100644
--- a/doc/html/man/infocmp.1m.html
+++ b/doc/html/man/infocmp.1m.html
@@ -514,7 +514,7 @@
 
        https://invisible-island.net/ncurses/tctest.html
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 

AUTHOR

diff --git a/doc/html/man/infotocap.1m.html b/doc/html/man/infotocap.1m.html
index 5e9ca04b..0ceba546 100644
--- a/doc/html/man/infotocap.1m.html
+++ b/doc/html/man/infotocap.1m.html
@@ -91,7 +91,7 @@
 

SEE ALSO

        infocmp(1m), tic(1m), curses(3x), terminfo(5)
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 

AUTHOR

diff --git a/doc/html/man/menu.3x.html b/doc/html/man/menu.3x.html
index ed9a098c..b7e3423d 100644
--- a/doc/html/man/menu.3x.html
+++ b/doc/html/man/menu.3x.html
@@ -223,7 +223,7 @@
        curses(3x) and related pages whose names  begin  "menu_"  for  detailed
        descriptions of the entry points.
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/doc/html/man/ncurses.3x.html b/doc/html/man/ncurses.3x.html
index 1fdc512a..e80aea69 100644
--- a/doc/html/man/ncurses.3x.html
+++ b/doc/html/man/ncurses.3x.html
@@ -60,7 +60,7 @@
        method of updating  character  screens  with  reasonable  optimization.
        This  implementation  is  "new  curses"  (ncurses)  and is the approved
        replacement for 4.4BSD classic curses,  which  has  been  discontinued.
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
        The  ncurses  library emulates the curses library of System V Release 4
        UNIX, and XPG4 (X/Open Portability Guide) curses  (also  known  as  XSI
diff --git a/doc/html/man/ncurses6-config.1.html b/doc/html/man/ncurses6-config.1.html
index 452c48db..d18c95af 100644
--- a/doc/html/man/ncurses6-config.1.html
+++ b/doc/html/man/ncurses6-config.1.html
@@ -113,7 +113,7 @@
 

SEE ALSO

        curses(3x)
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/doc/html/man/panel.3x.html b/doc/html/man/panel.3x.html
index a3922fba..82d2b38f 100644
--- a/doc/html/man/panel.3x.html
+++ b/doc/html/man/panel.3x.html
@@ -281,7 +281,7 @@
 

SEE ALSO

        curses(3x), curs_variables(3x),
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 

AUTHOR

diff --git a/doc/html/man/tabs.1.html b/doc/html/man/tabs.1.html
index 89a3fad4..94abb239 100644
--- a/doc/html/man/tabs.1.html
+++ b/doc/html/man/tabs.1.html
@@ -252,7 +252,7 @@
 

SEE ALSO

        infocmp(1m), tset(1), curses(3x), terminfo(5).
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/doc/html/man/terminfo.5.html b/doc/html/man/terminfo.5.html
index bc30bf97..6e854605 100644
--- a/doc/html/man/terminfo.5.html
+++ b/doc/html/man/terminfo.5.html
@@ -106,7 +106,7 @@
        have, by specifying how to perform screen operations, and by specifying
        padding requirements and initialization sequences.
 
-       This manual describes ncurses version 6.3 (patch 20220813).
+       This manual describes ncurses version 6.3 (patch 20220917).
 
 
 

Terminfo Entry Syntax

diff --git a/doc/html/man/tic.1m.html b/doc/html/man/tic.1m.html
index 4a0d0676..1c312a4e 100644
--- a/doc/html/man/tic.1m.html
+++ b/doc/html/man/tic.1m.html
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: tic.1m,v 1.82 2022/02/12 20:02:20 tom Exp @
+  * @Id: tic.1m,v 1.84 2022/09/17 19:01:24 tom Exp @
 -->
 
 
@@ -260,29 +260,37 @@
        -vn  specifies that (verbose) output be written to standard error trace
             information showing tic's progress.
 
-            The optional parameter n is a number  from  1  to  10,  inclusive,
-            indicating the desired level of detail of information.  If ncurses
-            is built  without  tracing  support,  the  optional  parameter  is
-            ignored.   If  n  is  omitted,  the  default  level is 1.  If n is
-            specified and greater than 1, the level of detail is increased.
+            The optional parameter n is a  number  from  1  to  9,  inclusive,
+            indicating the desired level of detail of information.
+
+            o   If  ncurses  is  built  without  tracing support, the optional
+                parameter is ignored.
+
+            o   If n is omitted, the default level is 1.
+
+            o   If n is specified and greater than 1, the level of  detail  is
+                increased,   and   the   output   is   written  (with  tracing
+                information) to the "trace" file.
 
             The debug flag levels are as follows:
 
-            1      Names of files created and linked
+            1   Names of files created and linked
+
+            2   Information related to the "use" facility
 
-            2      Information related to the "use" facility
+            3   Statistics from the hashing algorithm
 
-            3      Statistics from the hashing algorithm
+            4   Details of extended capabilities
 
-            5      String-table memory allocations
+            5   (unused)
 
-            7      Entries into the string-table
+            6   (unused)
 
-            8      List of tokens encountered by scanner
+            7   Entries into the string-table
 
-            9      All values computed in construction of the hash table
+            8   List of tokens encountered by scanner
 
-            If the debug level n is not given, it is taken to be one.
+            9   All values computed in construction of the hash table
 
        -W   By itself, the -w  option  will  not  force  long  strings  to  be
             wrapped.  Use the -W option to do this.
@@ -461,7 +469,7 @@
        captoinfo(1m),   infocmp(1m),   infotocap(1m),   toe(1m),   curses(3x),
        term(5).  terminfo(5).  user_caps(5).
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 

AUTHOR

diff --git a/doc/html/man/toe.1m.html b/doc/html/man/toe.1m.html
index 2cbd734b..c931b91b 100644
--- a/doc/html/man/toe.1m.html
+++ b/doc/html/man/toe.1m.html
@@ -171,7 +171,7 @@
        captoinfo(1m),   infocmp(1m),   infotocap(1m),   tic(1m),   curses(3x),
        terminfo(5).
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/doc/html/man/tput.1.html b/doc/html/man/tput.1.html
index 9e93cd3d..45f4169a 100644
--- a/doc/html/man/tput.1.html
+++ b/doc/html/man/tput.1.html
@@ -545,7 +545,7 @@
 

SEE ALSO

        clear(1), stty(1), tabs(1), tset(1), curs_termcap(3x), terminfo(5).
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/doc/html/man/tset.1.html b/doc/html/man/tset.1.html
index 243433b0..19d6be67 100644
--- a/doc/html/man/tset.1.html
+++ b/doc/html/man/tset.1.html
@@ -391,7 +391,7 @@
        csh(1),   sh(1),   stty(1),   curs_terminfo(3x),  tty(4),  terminfo(5),
        ttys(5), environ(7)
 
-       This describes ncurses version 6.3 (patch 20220813).
+       This describes ncurses version 6.3 (patch 20220917).
 
 
 
diff --git a/include/tic.h b/include/tic.h
index 89350592..302c06d8 100644
--- a/include/tic.h
+++ b/include/tic.h
@@ -34,7 +34,7 @@
  ****************************************************************************/
 
 /*
- * $Id: tic.h,v 1.85 2022/09/03 19:11:20 tom Exp $
+ * $Id: tic.h,v 1.86 2022/09/17 16:01:45 tom Exp $
  *	tic.h - Global variables and structures for the terminfo compiler.
  */
 
@@ -135,7 +135,7 @@ extern "C" {
 #define DEBUG_LEVEL(n)	((n) << TRACE_SHIFT)
 
 #define set_trace_level(n) \
-	_nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL + 1) - 1, \
+	_nc_tracing &= TRACE_MAXIMUM, \
 	_nc_tracing |= DEBUG_LEVEL(n)
 
 #ifdef TRACE
diff --git a/man/tic.1m b/man/tic.1m
index af646a26..17f576fd 100644
--- a/man/tic.1m
+++ b/man/tic.1m
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: tic.1m,v 1.82 2022/02/12 20:02:20 tom Exp $
+.\" $Id: tic.1m,v 1.84 2022/09/17 19:01:24 tom Exp $
 .TH @TIC@ 1M ""
 .ie \n(.g .ds `` \(lq
 .el       .ds `` ``
@@ -320,16 +320,22 @@ reports the version of ncurses which was used in this program, and exits.
 specifies that (verbose) output be written to standard error trace
 information showing \fB@TIC@\fP's progress.
 .IP
-The optional parameter \fIn\fP is a number from 1 to 10, inclusive,
+The optional parameter \fIn\fP is a number from 1 to 9, inclusive,
 indicating the desired level of detail of information.
+.RS
+.bP
 If ncurses is built without tracing support, the optional parameter is ignored.
+.bP
 If \fIn\fP is omitted, the default level is 1.
+.bP
 If \fIn\fP is specified and greater than 1, the level of
-detail is increased.
+detail is increased, and the output is written (with tracing information)
+to the \*(``trace\*('' file.
+.RE
 .RS
 .PP
 The debug flag levels are as follows:
-.TP
+.TP 4
 1
 Names of files created and linked
 .TP
@@ -339,8 +345,14 @@ Information related to the \*(``use\*('' facility
 3
 Statistics from the hashing algorithm
 .TP
+4
+Details of extended capabilities
+.TP
 5
-String-table memory allocations
+(unused)
+.TP
+6
+(unused)
 .TP
 7
 Entries into the string-table
@@ -350,8 +362,6 @@ List of tokens encountered by scanner
 .TP
 9
 All values computed in construction of the hash table
-.LP
-If the debug level \fIn\fP is not given, it is taken to be one.
 .RE
 .TP
 \fB\-W\fP
diff --git a/ncurses/tinfo/alloc_entry.c b/ncurses/tinfo/alloc_entry.c
index 219c76e6..90febbbd 100644
--- a/ncurses/tinfo/alloc_entry.c
+++ b/ncurses/tinfo/alloc_entry.c
@@ -48,7 +48,7 @@
 
 #include 
 
-MODULE_ID("$Id: alloc_entry.c,v 1.74 2022/08/20 18:03:14 tom Exp $")
+MODULE_ID("$Id: alloc_entry.c,v 1.76 2022/09/17 21:45:44 tom Exp $")
 
 #define ABSENT_OFFSET    -1
 #define CANCELLED_OFFSET -2
@@ -234,10 +234,11 @@ _nc_wrap_entry(ENTRY * const ep, bool copy_strings)
 #endif
 
     for (i = 0; i < nuses; i++) {
-	if (useoffsets[i] == ABSENT_OFFSET)
+	if (useoffsets[i] == ABSENT_OFFSET) {
 	    ep->uses[i].name = 0;
-	else
-	    ep->uses[i].name = (tp->str_table + useoffsets[i]);
+	} else {
+	    ep->uses[i].name = strdup(tp->str_table + useoffsets[i]);
+	}
     }
     DEBUG(2, (T_RETURN("")));
 }
@@ -250,6 +251,8 @@ _nc_merge_entry(ENTRY * const target, ENTRY * const source)
     TERMTYPE2 *from = &(source->tterm);
 #if NCURSES_XNAMES
     TERMTYPE2 copy;
+    size_t str_size = 0;
+    char *str_table = NULL;
 #endif
     unsigned i;
 
@@ -260,6 +263,46 @@ _nc_merge_entry(ENTRY * const target, ENTRY * const source)
     _nc_copy_termtype2(©, from);
     from = ©
     _nc_align_termtype(to, from);
+    str_size += strlen(to->term_names) + 1;
+    for_each_string(i, from) {
+	if (VALID_STRING(from->Strings[i]))
+	    str_size += strlen(from->Strings[i]) + 1;
+    }
+    for_each_string(i, to) {
+	if (VALID_STRING(to->Strings[i]))
+	    str_size += strlen(to->Strings[i]) + 1;
+    }
+    /* allocate a string-table large enough for both source/target, and
+     * copy all of the strings into that table.  In the merge, we will
+     * select from the original source/target lists to construct a new
+     * target list.
+     */
+    if (str_size != 0) {
+	char *str_copied;
+	if ((str_table = malloc(str_size)) == NULL)
+	    _nc_err_abort(MSG_NO_MEMORY);
+	str_copied = str_table;
+	strcpy(str_copied, to->term_names);
+	to->term_names = str_copied;
+	str_copied += strlen(str_copied) + 1;
+	for_each_string(i, from) {
+	    if (VALID_STRING(from->Strings[i])) {
+		strcpy(str_copied, from->Strings[i]);
+		from->Strings[i] = str_copied;
+		str_copied += strlen(str_copied) + 1;
+	    }
+	}
+	for_each_string(i, to) {
+	    if (VALID_STRING(to->Strings[i])) {
+		strcpy(str_copied, to->Strings[i]);
+		to->Strings[i] = str_copied;
+		str_copied += strlen(str_copied) + 1;
+	    }
+	}
+	free(to->str_table);
+	to->str_table = str_table;
+	free(from->str_table);
+    }
 #endif
     for_each_boolean(i, from) {
 	if (to->Booleans[i] != (NCURSES_SBOOL) CANCELLED_BOOLEAN) {
diff --git a/ncurses/tinfo/alloc_ttype.c b/ncurses/tinfo/alloc_ttype.c
index 42ef05f4..6220c210 100644
--- a/ncurses/tinfo/alloc_ttype.c
+++ b/ncurses/tinfo/alloc_ttype.c
@@ -43,7 +43,7 @@
 
 #include 
 
-MODULE_ID("$Id: alloc_ttype.c,v 1.44 2022/06/18 20:40:54 tom Exp $")
+MODULE_ID("$Id: alloc_ttype.c,v 1.46 2022/09/17 21:44:35 tom Exp $")
 
 #if NCURSES_XNAMES
 /*
@@ -559,7 +559,7 @@ copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode)
 	    }
 	    str_size += strlen(src->term_names) + 1;
 	}
-	for (i = 0; i < STRCOUNT; ++i) {
+	for_each_string(i, src) {
 	    if (VALID_STRING(src->Strings[i])) {
 		if (pass) {
 		    strcpy(new_table + str_size, src->Strings[i]);
@@ -572,7 +572,8 @@ copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode)
 	    dst->str_table = new_table;
 	} else {
 	    ++str_size;
-	    new_table = malloc(str_size);
+	    if ((new_table = malloc(str_size)) == NULL)
+		_nc_err_abort(MSG_NO_MEMORY);
 	}
     }
 
@@ -653,7 +654,8 @@ copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode)
 		dst->ext_str_table = new_table;
 	    } else {
 		++str_size;
-		new_table = calloc(str_size, 1);
+		if ((new_table = calloc(str_size, 1)) == NULL)
+		    _nc_err_abort(MSG_NO_MEMORY);
 	    }
 	}
     } else {
diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c
index 8acdbdd4..ff8d5657 100644
--- a/ncurses/tinfo/comp_parse.c
+++ b/ncurses/tinfo/comp_parse.c
@@ -48,7 +48,7 @@
 
 #include 
 
-MODULE_ID("$Id: comp_parse.c,v 1.123 2022/09/03 20:02:45 tom Exp $")
+MODULE_ID("$Id: comp_parse.c,v 1.124 2022/09/10 19:54:59 tom Exp $")
 
 static void sanity_check2(TERMTYPE2 *, bool);
 NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2;
@@ -252,6 +252,7 @@ _nc_read_entry_source(FILE *fp, char *buf,
 	    FreeIfNeeded(thisentry.tterm.Booleans);
 	    FreeIfNeeded(thisentry.tterm.Numbers);
 	    FreeIfNeeded(thisentry.tterm.Strings);
+	    FreeIfNeeded(thisentry.tterm.str_table);
 #if NCURSES_XNAMES
 	    FreeIfNeeded(thisentry.tterm.ext_Names);
 	    FreeIfNeeded(thisentry.tterm.ext_str_table);
@@ -412,7 +413,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
 	int matchcount = 0;
 
 	for_entry_list(rp) {
-	    if (qp > rp
+	    if (qp > rp // FIXME - pointer-comparison is wrong...
 		&& check_collisions(qp->tterm.term_names,
 				    rp->tterm.term_names,
 				    matchcount + 1)) {
diff --git a/ncurses/trace/lib_trace.c b/ncurses/trace/lib_trace.c
index b6f2a75e..effd3c1c 100644
--- a/ncurses/trace/lib_trace.c
+++ b/ncurses/trace/lib_trace.c
@@ -48,7 +48,7 @@
 
 #include 
 
-MODULE_ID("$Id: lib_trace.c,v 1.100 2022/07/23 20:08:45 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.101 2022/09/17 14:57:02 tom Exp $")
 
 NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
 
@@ -108,8 +108,33 @@ NCURSES_EXPORT(unsigned)
 curses_trace(unsigned tracelevel)
 {
     unsigned result;
+
 #if defined(TRACE)
+    int bit;
+
+#define DATA(name) { name, #name }
+    static struct {
+	unsigned mask;
+	const char *name;
+    } trace_names[] = {
+	DATA(TRACE_TIMES),
+	    DATA(TRACE_TPUTS),
+	    DATA(TRACE_UPDATE),
+	    DATA(TRACE_MOVE),
+	    DATA(TRACE_CHARPUT),
+	    DATA(TRACE_CALLS),
+	    DATA(TRACE_VIRTPUT),
+	    DATA(TRACE_IEVENT),
+	    DATA(TRACE_BITS),
+	    DATA(TRACE_ICALLS),
+	    DATA(TRACE_CCALLS),
+	    DATA(TRACE_DATABASE),
+	    DATA(TRACE_ATTRS)
+    };
+#undef DATA
+
     Locked(result = _nc_tracing);
+
     if ((MyFP == 0) && tracelevel) {
 	MyInit = TRUE;
 	if (MyFD >= 0) {
@@ -151,6 +176,24 @@ curses_trace(unsigned tracelevel)
 		NCURSES_VERSION,
 		NCURSES_VERSION_PATCH,
 		tracelevel);
+
+#define SPECIAL_MASK(mask) \
+	    if ((tracelevel & mask) == mask) \
+		_tracef("- %s (%u)", #mask, mask)
+
+	for (bit = 0; bit < TRACE_SHIFT; ++bit) {
+	    unsigned mask = (1U << bit) & tracelevel;
+	    if ((mask & trace_names[bit].mask) != 0) {
+		_tracef("- %s (%u)", trace_names[bit].name, mask);
+	    }
+	}
+	SPECIAL_MASK(TRACE_MAXIMUM);
+	else
+	SPECIAL_MASK(TRACE_ORDINARY);
+
+	if (tracelevel > TRACE_MAXIMUM) {
+	    _tracef("- DEBUG_LEVEL(%u)", tracelevel >> TRACE_SHIFT);
+	}
     } else if (tracelevel == 0) {
 	if (MyFP != 0) {
 	    MyFD = dup(MyFD);	/* allow reopen of same file */
diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog
index 4569793d..3fee82a9 100644
--- a/package/debian-mingw/changelog
+++ b/package/debian-mingw/changelog
@@ -1,8 +1,8 @@
-ncurses6 (6.3+20220910) unstable; urgency=low
+ncurses6 (6.3+20220917) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Sat, 10 Sep 2022 05:26:46 -0400
+ -- Thomas E. Dickey   Sat, 17 Sep 2022 06:53:31 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog
index 4569793d..3fee82a9 100644
--- a/package/debian-mingw64/changelog
+++ b/package/debian-mingw64/changelog
@@ -1,8 +1,8 @@
-ncurses6 (6.3+20220910) unstable; urgency=low
+ncurses6 (6.3+20220917) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Sat, 10 Sep 2022 05:26:46 -0400
+ -- Thomas E. Dickey   Sat, 17 Sep 2022 06:53:31 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
diff --git a/package/debian/changelog b/package/debian/changelog
index d93cef9d..aacb3e52 100644
--- a/package/debian/changelog
+++ b/package/debian/changelog
@@ -1,8 +1,8 @@
-ncurses6 (6.3+20220910) unstable; urgency=low
+ncurses6 (6.3+20220917) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Sat, 10 Sep 2022 05:26:46 -0400
+ -- Thomas E. Dickey   Sat, 17 Sep 2022 06:53:31 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi
index b6b505e3..c291ccf5 100644
--- a/package/mingw-ncurses.nsi
+++ b/package/mingw-ncurses.nsi
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.541 2022/09/10 09:26:46 tom Exp $
+; $Id: mingw-ncurses.nsi,v 1.542 2022/09/17 10:53:30 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  "0910"
+!define VERSION_MMDD  "0917"
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
 
 !define MY_ABI   "5"
diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec
index 5bf47139..9b8ce6af 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: 20220910
+Release: 20220917
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
diff --git a/package/ncurses.spec b/package/ncurses.spec
index b571b10a..27e87998 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: 20220910
+Release: 20220917
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
diff --git a/package/ncursest.spec b/package/ncursest.spec
index c2ec62a3..0141bc16 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: 20220910
+Release: 20220917
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
diff --git a/progs/progs.priv.h b/progs/progs.priv.h
index e6498db0..84b46c01 100644
--- a/progs/progs.priv.h
+++ b/progs/progs.priv.h
@@ -31,7 +31,7 @@
  *  Author: Thomas E. Dickey                    1997-on                     *
  ****************************************************************************/
 /*
- * $Id: progs.priv.h,v 1.55 2022/09/10 21:47:39 tom Exp $
+ * $Id: progs.priv.h,v 1.58 2022/09/17 18:58:05 tom Exp $
  *
  *	progs.priv.h
  *
@@ -147,8 +147,6 @@ extern int optind;
 #endif
 #endif
 
-#define VtoTrace(opt) (unsigned) ((opt > 0) ? opt : (opt == 0))
-
 /* error-returns for tput */
 #define ErrUsage	2
 #define ErrTermType	3
@@ -234,8 +232,22 @@ extern int optind;
 
 #define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
 
+#define VtoTrace(opt) (unsigned) ((opt > 0) ? opt : (opt == 0))
+
+/*
+ * If configured for tracing, the debug- and trace-output are merged together
+ * in the trace file for "upper" levels of the verbose option.
+ */
 #ifdef TRACE
-#define use_verbosity(level) do { set_trace_level(level); if (_nc_tracing > DEBUG_LEVEL(2)) _nc_tracing |= TRACE_MAXIMUM; } while (0)
+#define use_verbosity(level) do { \
+ 		set_trace_level(level); \
+		if (_nc_tracing > DEBUG_LEVEL(2)) \
+		    _nc_tracing |= TRACE_MAXIMUM; \
+		else if (_nc_tracing == DEBUG_LEVEL(2)) \
+		    _nc_tracing |= TRACE_ORDINARY; \
+		if (level >= 2) \
+		    curses_trace(_nc_tracing); \
+	} while (0)
 #else
 #define use_verbosity(level) do { set_trace_level(level); } while (0)
 #endif
diff --git a/progs/tic.c b/progs/tic.c
index cb7baf07..93a0b491 100644
--- a/progs/tic.c
+++ b/progs/tic.c
@@ -49,7 +49,7 @@
 #include 
 #include 
 
-MODULE_ID("$Id: tic.c,v 1.318 2022/09/03 23:29:16 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.320 2022/09/17 18:55:28 tom Exp $")
 
 #define STDIN_NAME ""
 
@@ -722,7 +722,8 @@ main(int argc, char *argv[])
 	sortmode = S_TERMCAP;
     }
 #if NCURSES_XNAMES
-    use_extended_names(FALSE);
+    /* set this directly to avoid interaction with -v and -D options */
+    _nc_user_definable = FALSE;
 #endif
     _nc_strict_bsd = 0;
 
@@ -853,7 +854,6 @@ main(int argc, char *argv[])
 	    _nc_disable_period = TRUE;
 	    /* FALLTHRU */
 	case 'x':
-	    use_extended_names(TRUE);
 	    using_extensions = TRUE;
 	    break;
 #endif
@@ -863,9 +863,24 @@ main(int argc, char *argv[])
 	last_opt = this_opt;
     }
 
+    /*
+     * If the -v option is set, it may override the $NCURSES_TRACE environment
+     * variable, e.g., for -v3 and up.
+     */
     debug_level = VtoTrace(v_opt);
     use_verbosity(debug_level);
 
+    /*
+     * Do this after setting debug_level, since the function calls START_TRACE,
+     * which uses the $NCURSES_TRACE environment variable if _nc_tracing bits
+     * for tracing are zero.
+     */
+#if NCURSES_XNAMES
+    if (using_extensions) {
+	use_extended_names(TRUE);
+    }
+#endif
+
     if (_nc_tracing) {
 	save_check_termtype = _nc_check_termtype2;
 	_nc_check_termtype2 = check_termtype;
-- 
2.45.0