From: Thomas E. Dickey Date: Sun, 5 Jul 2015 01:59:07 +0000 (+0000) Subject: ncurses 6.0 - patch 20150704 X-Git-Tag: v6.0~5 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=955553313af0a9fa960ec0faba552c0bae4ca65e ncurses 6.0 - patch 20150704 + fix a few problems reported by Coverity. + fix comparison against "/usr/include" in misc/gen-pkgconfig.in (report by Daiki Ueno, Debian #790548, cf: 20141213). --- diff --git a/NEWS b/NEWS index 8f50430a..25963a85 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.2448 2015/06/27 23:12:23 tom Exp $ +-- $Id: NEWS,v 1.2451 2015/07/04 21:01:57 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,11 @@ 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. +20150704 + + fix a few problems reported by Coverity. + + fix comparison against "/usr/include" in misc/gen-pkgconfig.in + (report by Daiki Ueno, Debian #790548, cf: 20141213). + 20150627 + modify configure script to remove deprecated ABI 5 symbols when building ABI 6. diff --git a/VERSION b/VERSION index dc1c3ea9..1052e27e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:9 6.0 20150627 +5:0:9 6.0 20150704 diff --git a/dist.mk b/dist.mk index e6ed1c68..4ebae2ed 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1057 2015/06/26 08:39:24 tom Exp $ +# $Id: dist.mk,v 1.1058 2015/07/03 23:28:48 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 0 -NCURSES_PATCH = 20150627 +NCURSES_PATCH = 20150704 # 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 4e60ff2c..62d09ff6 100644 --- a/misc/gen-pkgconfig.in +++ b/misc/gen-pkgconfig.in @@ -1,5 +1,5 @@ #!@SHELL@ -# $Id: gen-pkgconfig.in,v 1.28 2015/05/16 20:04:42 tom Exp $ +# $Id: gen-pkgconfig.in,v 1.29 2015/07/04 20:37:01 tom Exp $ ############################################################################## # Copyright (c) 2009-2014,2015 Free Software Foundation, Inc. # # # @@ -66,9 +66,9 @@ FORM_LIBRARY="${FORM_NAME}@USE_ARG_SUFFIX@" CFLAGS="@PKG_CFLAGS@" if test "$includedir" != "/usr/include" ; then - includetop=`echo "$includedir" | sed -e 's,/include/[^/]*$,/include/,'` + includetop=`echo "$includedir" | sed -e 's,/include/[^/]*$,/include,'` test "$includetop" = "/usr/include" && includetop="$includedir" - if test "x$includetop" != "$includedir" + if test "x$includetop" != "x$includedir" then CFLAGS="$CFLAGS -I${includetop}" fi diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index 60bf488c..36b6e1ee 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -84,7 +84,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_mouse.c,v 1.165 2014/11/01 12:27:59 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.166 2015/07/05 00:28:27 tom Exp $") #include @@ -1248,7 +1248,6 @@ decode_xterm_SGR1006(SCREEN *sp, MEVENT * eventp) int b = data.params[0]; int b3 = 1 + (b & 3); - result = TRUE; eventp->id = NORMAL_EVENT; if (data.final == 'M') { (void) handle_wheel(sp, eventp, b, (b & 64) == 64); diff --git a/ncurses/base/lib_screen.c b/ncurses/base/lib_screen.c index c11df4bb..a03ceece 100644 --- a/ncurses/base/lib_screen.c +++ b/ncurses/base/lib_screen.c @@ -41,7 +41,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_screen.c,v 1.75 2015/04/18 21:58:03 tom Exp $") +MODULE_ID("$Id: lib_screen.c,v 1.77 2015/07/04 22:54:14 tom Exp $") #define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */ @@ -179,6 +179,7 @@ read_txt(FILE *fp) result = 0; break; } + result = buffer; } ch = fgetc(fp); if (ch == EOF) @@ -351,7 +352,7 @@ decode_cchar(char *source, cchar_t *fillin, cchar_t *target) while (source[0] == MARKER && source[1] == APPEND) { source += 2; source = decode_char(source, &value); - if (append++ < CCHARW_MAX) { + if (++append < CCHARW_MAX) { chars[append] = (wchar_t) value; } } diff --git a/ncurses/tty/lib_twait.c b/ncurses/tty/lib_twait.c index e912a638..15d07c3e 100644 --- a/ncurses/tty/lib_twait.c +++ b/ncurses/tty/lib_twait.c @@ -75,7 +75,7 @@ #endif #undef CUR -MODULE_ID("$Id: lib_twait.c,v 1.69 2015/05/02 22:23:16 tom Exp $") +MODULE_ID("$Id: lib_twait.c,v 1.70 2015/07/04 21:01:02 tom Exp $") static long _nc_gettime(TimeType * t0, int first) @@ -230,7 +230,8 @@ _nc_timed_wait(SCREEN *sp MAYBE_UNUSED, #ifdef NCURSES_WGETCH_EVENTS if ((mode & TW_EVENT) && evl) { - fds = typeMalloc(struct pollfd, MIN_FDS + evl->count); + if (fds == fd_list) + fds = typeMalloc(struct pollfd, MIN_FDS + evl->count); if (fds == 0) return TW_NONE; } diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 0ba6056f..7a38e3ee 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20150627) unstable; urgency=low +ncurses6 (6.0+20150704) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Fri, 26 Jun 2015 04:39:24 -0400 + -- Thomas E. Dickey Fri, 03 Jul 2015 19:28:49 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 0ba6056f..7a38e3ee 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20150627) unstable; urgency=low +ncurses6 (6.0+20150704) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Fri, 26 Jun 2015 04:39:24 -0400 + -- Thomas E. Dickey Fri, 03 Jul 2015 19:28:49 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index a9db3e2d..c1a26a31 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.0+20150627) unstable; urgency=low +ncurses6 (6.0+20150704) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Fri, 26 Jun 2015 04:39:24 -0400 + -- Thomas E. Dickey Fri, 03 Jul 2015 19:28:48 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index a4475178..8986cb2b 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.110 2015/06/26 08:39:24 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.111 2015/07/03 23:28:48 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "0" !define VERSION_YYYY "2015" -!define VERSION_MMDD "0627" +!define VERSION_MMDD "0704" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 60a5a1aa..ac0bc931 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.0 -Release: 20150627 +Release: 20150704 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 323aaeb4..84d45bad 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.0 -Release: 20150627 +Release: 20150704 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/progs/MKtermsort.sh b/progs/MKtermsort.sh index 2247f14e..9f5db27b 100755 --- a/progs/MKtermsort.sh +++ b/progs/MKtermsort.sh @@ -1,10 +1,10 @@ #!/bin/sh -# $Id: MKtermsort.sh,v 1.10 2008/07/12 20:22:54 tom Exp $ +# $Id: MKtermsort.sh,v 1.11 2015/07/04 23:59:54 tom Exp $ # # MKtermsort.sh -- generate indirection vectors for the various sort methods # ############################################################################## -# Copyright (c) 1998-2003,2008 Free Software Foundation, Inc. # +# Copyright (c) 1998-2008,2015 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -139,24 +139,30 @@ echo ""; echo "static const bool bool_from_termcap[] = {"; $AWK <$DATA ' -$3 == "bool" && substr($7, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";} -$3 == "bool" && substr($7, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";} +BEGIN { count = 0; valid = 0; } +$3 == "bool" && substr($7, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */"; count++; } +$3 == "bool" && substr($7, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */"; valid = count++; } +END { printf "#define OK_bool_from_termcap %d\n", valid; } ' echo "};"; echo ""; echo "static const bool num_from_termcap[] = {"; $AWK <$DATA ' -$3 == "num" && substr($7, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";} -$3 == "num" && substr($7, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";} +BEGIN { count = 0; valid = 0; } +$3 == "num" && substr($7, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */"; count++; } +$3 == "num" && substr($7, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */"; valid = count++; } +END { printf "#define OK_num_from_termcap %d\n", valid; } ' echo "};"; echo ""; echo "static const bool str_from_termcap[] = {"; $AWK <$DATA ' -$3 == "str" && substr($7, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";} -$3 == "str" && substr($7, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";} +BEGIN { count = 0; valid = 0; } +$3 == "str" && substr($7, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */"; count++; } +$3 == "str" && substr($7, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */"; valid = count++; } +END { printf "#define OK_str_from_termcap %d\n", valid; } ' echo "};"; echo ""; diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 55fe907a..f8b4c22e 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -39,7 +39,7 @@ #include "termsort.c" /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.115 2015/05/27 00:57:40 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.117 2015/07/05 00:01:04 tom Exp $") #define INDENT 8 #define DISCARD(string) string = ABSENT_STRING @@ -156,17 +156,17 @@ _nc_leaks_dump_entry(void) #endif #define NameTrans(check,result) \ - if (OkIndex(np->nte_index, check) \ + if ((np->nte_index <= OK_ ## check) \ && check[np->nte_index]) \ return (result[np->nte_index]) NCURSES_CONST char * nametrans(const char *name) -/* translate a capability name from termcap to terminfo */ +/* translate a capability name to termcap from terminfo */ { const struct name_table_entry *np; - if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != 0) + if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != 0) { switch (np->nte_type) { case BOOLEAN: NameTrans(bool_from_termcap, boolcodes); @@ -180,6 +180,7 @@ nametrans(const char *name) NameTrans(str_from_termcap, strcodes); break; } + } return (0); } @@ -777,6 +778,8 @@ fmt_entry(TERMTYPE *tterm, trimmed_sgr0 = _nc_trim_sgr0(tterm); if (strcmp(capability, trimmed_sgr0)) capability = trimmed_sgr0; + else + free(trimmed_sgr0); set_attributes = my_sgr; } diff --git a/progs/tabs.c b/progs/tabs.c index 64f98bdc..9974c335 100644 --- a/progs/tabs.c +++ b/progs/tabs.c @@ -37,7 +37,7 @@ #define USE_LIBTINFO #include -MODULE_ID("$Id: tabs.c,v 1.36 2015/04/18 22:20:21 James.Clarke Exp $") +MODULE_ID("$Id: tabs.c,v 1.37 2015/07/04 21:14:42 tom Exp $") static void usage(void) GCC_NORETURN; @@ -288,6 +288,7 @@ add_to_tab_list(char **append, const char *value) *append = result; } + free(copied); return result; } diff --git a/progs/tic.c b/progs/tic.c index 8182e2ee..10cc4d2d 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.210 2015/05/27 00:58:18 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.211 2015/07/04 21:12:41 tom Exp $") #define STDIN_NAME "" @@ -2337,13 +2337,15 @@ check_termtype(TERMTYPE *tp, bool literal) ("will trim sgr0\n\toriginal sgr0=%s\n\ttrimmed sgr0=%s", _nc_visbuf2(1, exit_attribute_mode), _nc_visbuf2(2, check_sgr0))); - free(check_sgr0); } else { DEBUG(2, ("will not trim sgr0\n\toriginal sgr0=%s", _nc_visbuf(exit_attribute_mode))); } } + if (check_sgr0 != exit_attribute_mode) { + free(check_sgr0); + } } #ifdef TRACE show_where(2); diff --git a/test/gdc.c b/test/gdc.c index 04ea1b6b..81de6c8d 100644 --- a/test/gdc.c +++ b/test/gdc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,7 +33,7 @@ * modified 10-18-89 for curses (jrl) * 10-18-89 added signal handling * - * $Id: gdc.c,v 1.42 2014/08/09 22:28:42 tom Exp $ + * $Id: gdc.c,v 1.44 2015/07/04 21:28:28 tom Exp $ */ #include @@ -380,7 +380,11 @@ main(int argc, char *argv[]) /* this depends on the detailed format of ctime(3) */ (void) strncpy(buf, ctime(&now), (size_t) 30); - (void) strcpy(buf + 10, buf + 19); + { + char *d2 = buf + 10; + char *s2 = buf + 19; + while ((*d2++ = *s2++) != '\0') ; + } MvAddStr(16, 30, buf); move(6, 0); diff --git a/test/testcurs.c b/test/testcurs.c index a1f00576..7a44a2c6 100644 --- a/test/testcurs.c +++ b/test/testcurs.c @@ -6,7 +6,7 @@ * wrs(5/28/93) -- modified to be consistent (perform identically) with either * PDCurses or under Unix System V, R4 * - * $Id: testcurs.c,v 1.49 2014/07/27 00:25:14 tom Exp $ + * $Id: testcurs.c,v 1.50 2015/07/05 00:11:10 tom Exp $ */ #include @@ -437,7 +437,7 @@ inputTest(WINDOW *win) "%d %[][a-zA-Z]s", "%d %[^0-9]" }; - const char *format = fmt[(unsigned) repeat % SIZEOF(fmt)]; + char *format = strdup(fmt[(unsigned) repeat % SIZEOF(fmt)]); wclear(win); MvWAddStr(win, 3, 2, "The window should have moved"); @@ -453,12 +453,13 @@ inputTest(WINDOW *win) noraw(); num = 0; *buffer = 0; - answered = mvwscanw(win, 7, 6, strdup(format), &num, buffer); + answered = mvwscanw(win, 7, 6, format, &num, buffer); MvWPrintw(win, 8, 6, "String: %s Number: %d (%d values read)", buffer, num, answered); Continue(win); ++repeat; + free(format); } while (answered > 0); }