diff -Nru libedit-3.1-20160903/ChangeLog libedit-3.1-20170329/ChangeLog --- libedit-3.1-20160903/ChangeLog 2016-09-03 13:51:19.000000000 +0000 +++ libedit-3.1-20170329/ChangeLog 2017-03-29 18:18:15.000000000 +0000 @@ -1,6 +1,12 @@ * See also NetBSD changelog: http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit +2017-03-29 Jess Thrysoee + + * version-info: 0:56:0 + + * all: sync with upstream source + 2016-09-03 Jess Thrysoee * version-info: 0:55:0 diff -Nru libedit-3.1-20160903/configure libedit-3.1-20170329/configure --- libedit-3.1-20160903/configure 2016-09-03 13:51:44.000000000 +0000 +++ libedit-3.1-20170329/configure 2017-03-29 18:18:32.000000000 +0000 @@ -586,7 +586,7 @@ # Identity of this package. PACKAGE_NAME='libedit' -PACKAGE_TARNAME='libedit-20160903' +PACKAGE_TARNAME='libedit-20170329' PACKAGE_VERSION='3.1' PACKAGE_STRING='libedit 3.1' PACKAGE_BUGREPORT='' @@ -1374,7 +1374,7 @@ --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root - [DATAROOTDIR/doc/libedit-20160903] + [DATAROOTDIR/doc/libedit-20170329] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -4223,7 +4223,7 @@ # Define the identity of the package. - PACKAGE='libedit-20160903' + PACKAGE='libedit-20170329' VERSION='3.1' @@ -12118,7 +12118,7 @@ # libtool -version-info -LT_VERSION=0:55:0 +LT_VERSION=0:56:0 # Check whether --enable-silent-rules was given. diff -Nru libedit-3.1-20160903/configure.ac libedit-3.1-20170329/configure.ac --- libedit-3.1-20160903/configure.ac 2016-09-03 13:51:30.000000000 +0000 +++ libedit-3.1-20170329/configure.ac 2017-03-29 18:18:18.000000000 +0000 @@ -35,7 +35,7 @@ AC_PROG_LIBTOOL # libtool -version-info -AC_SUBST(LT_VERSION, [0:55:0]) +AC_SUBST(LT_VERSION, [0:56:0]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff -Nru libedit-3.1-20160903/debian/changelog libedit-3.1-20170329/debian/changelog --- libedit-3.1-20160903/debian/changelog 2017-01-18 12:23:36.000000000 +0000 +++ libedit-3.1-20170329/debian/changelog 2017-06-19 22:11:48.000000000 +0000 @@ -1,3 +1,10 @@ +libedit (3.1-20170329-1) unstable; urgency=medium + + * New upstream release + * Standards-Version updated 4.0.0 + + -- Sylvestre Ledru Tue, 20 Jun 2017 00:11:48 +0200 + libedit (3.1-20160903-3) unstable; urgency=medium * Fix the wrong links to the manpage (Closes: #851700) diff -Nru libedit-3.1-20160903/debian/control libedit-3.1-20170329/debian/control --- libedit-3.1-20160903/debian/control 2016-11-21 15:41:10.000000000 +0000 +++ libedit-3.1-20170329/debian/control 2017-06-19 22:11:48.000000000 +0000 @@ -6,7 +6,7 @@ Build-Depends: dpkg-dev (>= 1.16.1~), debhelper (>= 9), dh-autoreconf, pkg-config, groff-base, libbsd-dev (>= 0.1.3), libncurses5-dev (>= 5.9-2), bsdmainutils -Standards-Version: 3.9.8 +Standards-Version: 4.0.0 Vcs-Git: git://anonscm.debian.org/collab-maint/libedit.git Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/libedit.git/ Homepage: http://www.thrysoee.dk/editline/ diff -Nru libedit-3.1-20160903/debian/patches/update-soname.diff libedit-3.1-20170329/debian/patches/update-soname.diff --- libedit-3.1-20160903/debian/patches/update-soname.diff 2016-11-21 15:41:10.000000000 +0000 +++ libedit-3.1-20170329/debian/patches/update-soname.diff 2017-06-19 22:11:48.000000000 +0000 @@ -6,8 +6,8 @@ AC_PROG_LIBTOOL # libtool -version-info --AC_SUBST(LT_VERSION, [0:55:0]) -+AC_SUBST(LT_VERSION, [2:55:0]) +-AC_SUBST(LT_VERSION, [0:56:0]) ++AC_SUBST(LT_VERSION, [2:56:0]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff -Nru libedit-3.1-20160903/src/chartype.c libedit-3.1-20170329/src/chartype.c --- libedit-3.1-20160903/src/chartype.c 2016-09-03 13:48:03.000000000 +0000 +++ libedit-3.1-20170329/src/chartype.c 2017-03-29 18:15:04.000000000 +0000 @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.c,v 1.30 2016/05/09 21:46:56 christos Exp $ */ +/* $NetBSD: chartype.c,v 1.31 2017/01/09 02:54:18 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: chartype.c,v 1.30 2016/05/09 21:46:56 christos Exp $"); +__RCSID("$NetBSD: chartype.c,v 1.31 2017/01/09 02:54:18 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -156,7 +156,7 @@ if (ct_conv_wbuff_resize(conv, bufspace + CT_BUFSIZ) == -1) return NULL; - wargv = el_malloc((size_t)argc * sizeof(*wargv)); + wargv = el_malloc((size_t)(argc + 1) * sizeof(*wargv)); for (i = 0, p = conv->wbuff; i < argc; ++i) { if (!argv[i]) { /* don't pass null pointers to mbstowcs */ @@ -174,6 +174,7 @@ bufspace -= (size_t)bytes; p += bytes; } + wargv[i] = NULL; return wargv; } diff -Nru libedit-3.1-20160903/src/editline/readline.h libedit-3.1-20170329/src/editline/readline.h --- libedit-3.1-20160903/src/editline/readline.h 2016-09-03 13:48:03.000000000 +0000 +++ libedit-3.1-20170329/src/editline/readline.h 2017-03-29 18:15:04.000000000 +0000 @@ -1,4 +1,4 @@ -/* $NetBSD: readline.h,v 1.40 2016/08/24 13:10:59 christos Exp $ */ +/* $NetBSD: readline.h,v 1.41 2016/10/28 18:32:35 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -121,6 +121,7 @@ extern char *rl_terminal_name; extern int rl_already_prompted; extern char *rl_prompt; +extern int rl_done; /* * The following is not implemented */ diff -Nru libedit-3.1-20160903/src/filecomplete.c libedit-3.1-20170329/src/filecomplete.c --- libedit-3.1-20160903/src/filecomplete.c 2016-09-03 13:48:03.000000000 +0000 +++ libedit-3.1-20170329/src/filecomplete.c 2017-03-29 18:15:04.000000000 +0000 @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.c,v 1.43 2016/04/11 00:50:13 christos Exp $ */ +/* $NetBSD: filecomplete.c,v 1.44 2016/10/31 17:46:32 abhinav Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: filecomplete.c,v 1.43 2016/04/11 00:50:13 christos Exp $"); +__RCSID("$NetBSD: filecomplete.c,v 1.44 2016/10/31 17:46:32 abhinav Exp $"); #endif /* not lint && not SCCSID */ #include @@ -477,8 +477,6 @@ ct_decode_string(matches[0], &el->el_scratch)); } - if (what_to_do == '?') - goto display_matches; if (matches[2] == NULL && (matches[1] == NULL || strcmp(matches[0], matches[1]) == 0)) { @@ -490,8 +488,7 @@ el_winsertstr(el, ct_decode_string((*app_func)(matches[0]), &el->el_scratch)); - } else if (what_to_do == '!') { - display_matches: + } else if (what_to_do == '!' || what_to_do == '?') { /* * More than one match and requested to list possible * matches. diff -Nru libedit-3.1-20160903/src/hist.c libedit-3.1-20170329/src/hist.c --- libedit-3.1-20160903/src/hist.c 2016-09-03 13:48:03.000000000 +0000 +++ libedit-3.1-20170329/src/hist.c 2017-03-29 18:15:04.000000000 +0000 @@ -1,4 +1,4 @@ -/* $NetBSD: hist.c,v 1.29 2016/05/09 21:46:56 christos Exp $ */ +/* $NetBSD: hist.c,v 1.32 2017/03/05 19:23:58 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: hist.c,v 1.29 2016/05/09 21:46:56 christos Exp $"); +__RCSID("$NetBSD: hist.c,v 1.32 2017/03/05 19:23:58 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -46,6 +46,7 @@ */ #include #include +#include #include "el.h" @@ -101,6 +102,7 @@ { const wchar_t *hp; int h; + size_t blen, hlen; if (el->el_history.eventno == 0) { /* if really the current line */ (void) wcsncpy(el->el_line.buffer, el->el_history.buf, @@ -126,14 +128,16 @@ return CC_ERROR; for (h = 1; h < el->el_history.eventno; h++) - if ((hp = HIST_NEXT(el)) == NULL) { - el->el_history.eventno = h; - return CC_ERROR; - } - (void) wcsncpy(el->el_line.buffer, hp, - (size_t)(el->el_line.limit - el->el_line.buffer)); - el->el_line.buffer[el->el_line.limit - el->el_line.buffer - 1] = '\0'; - el->el_line.lastchar = el->el_line.buffer + wcslen(el->el_line.buffer); + if ((hp = HIST_NEXT(el)) == NULL) + goto out; + + hlen = wcslen(hp) + 1; + blen = (size_t)(el->el_line.limit - el->el_line.buffer); + if (hlen > blen && !ch_enlargebufs(el, hlen)) + goto out; + + memcpy(el->el_line.buffer, hp, hlen * sizeof(*hp)); + el->el_line.lastchar = el->el_line.buffer + hlen - 1; if (el->el_line.lastchar > el->el_line.buffer && el->el_line.lastchar[-1] == '\n') @@ -149,6 +153,10 @@ el->el_line.cursor = el->el_line.lastchar; return CC_REFRESH; +out: + el->el_history.eventno = h; + return CC_ERROR; + } @@ -166,11 +174,32 @@ return -1; if (argc == 1 || wcscmp(argv[1], L"list") == 0) { + size_t maxlen = 0; + char *buf = NULL; + int hno = 1; /* List history entries */ - for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el)) - (void) fprintf(el->el_outfile, "%d %s", - el->el_history.ev.num, ct_encode_string(str, &el->el_scratch)); + for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el)) { + char *ptr = + ct_encode_string(str, &el->el_scratch); + size_t len = strlen(ptr); + if (len > 0 && ptr[len - 1] == '\n') + ptr[--len] = '\0'; + len = len * 4 + 1; + if (len >= maxlen) { + maxlen = len + 1024; + char *nbuf = el_realloc(buf, maxlen); + if (nbuf == NULL) { + el_free(buf); + return -1; + } + buf = nbuf; + } + strvis(buf, ptr, VIS_NL); + (void) fprintf(el->el_outfile, "%d\t%s\n", + hno++, buf); + } + el_free(buf); return 0; } diff -Nru libedit-3.1-20160903/src/read.c libedit-3.1-20170329/src/read.c --- libedit-3.1-20160903/src/read.c 2016-09-03 13:48:03.000000000 +0000 +++ libedit-3.1-20170329/src/read.c 2017-03-29 18:15:04.000000000 +0000 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.101 2016/05/25 13:01:11 christos Exp $ */ +/* $NetBSD: read.c,v 1.102 2016/12/11 15:47:06 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: read.c,v 1.101 2016/05/25 13:01:11 christos Exp $"); +__RCSID("$NetBSD: read.c,v 1.102 2016/12/11 15:47:06 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -111,6 +111,7 @@ read_clearmacros(&el_read->macros); el_free(el_read->macros.macro); el_read->macros.macro = NULL; + el_free(el_read); } /* el_read_setfn(): diff -Nru libedit-3.1-20160903/src/readline.c libedit-3.1-20170329/src/readline.c --- libedit-3.1-20160903/src/readline.c 2016-09-03 13:48:03.000000000 +0000 +++ libedit-3.1-20170329/src/readline.c 2017-03-29 18:15:04.000000000 +0000 @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.138 2016/09/01 13:23:44 mbalmer Exp $ */ +/* $NetBSD: readline.c,v 1.140 2017/01/09 03:09:05 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.138 2016/09/01 13:23:44 mbalmer Exp $"); +__RCSID("$NetBSD: readline.c,v 1.140 2017/01/09 03:09:05 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -200,7 +200,7 @@ { int i; - i = (*rl_getc_function)(NULL); + i = (*rl_getc_function)(rl_instream); if (i == -1) return 0; *c = (wchar_t)i; @@ -560,7 +560,7 @@ idx++; } if (sign) - num = history_length - num + 1; + num = history_length - num + history_base; if (!(he = history_get(num))) return NULL; diff -Nru libedit-3.1-20160903/src/vis.c libedit-3.1-20170329/src/vis.c --- libedit-3.1-20160903/src/vis.c 2016-09-03 13:48:03.000000000 +0000 +++ libedit-3.1-20170329/src/vis.c 2017-03-29 18:15:04.000000000 +0000 @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.71 2016/01/14 20:41:23 christos Exp $ */ +/* $NetBSD: vis.c,v 1.72 2017/02/12 22:37:49 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -58,7 +58,7 @@ #include "config.h" #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.71 2016/01/14 20:41:23 christos Exp $"); +__RCSID("$NetBSD: vis.c,v 1.72 2017/02/12 22:37:49 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -407,6 +407,14 @@ _DIAGASSERT(mbsrc != NULL || mblength == 0); _DIAGASSERT(mbextra != NULL); + mbslength = (ssize_t)mblength; + /* + * When inputing a single character, must also read in the + * next character for nextc, the look-ahead character. + */ + if (mbslength == 1) + mbslength++; + /* * Input (mbsrc) is a char string considered to be multibyte * characters. The input loop will read this string pulling @@ -423,12 +431,12 @@ /* Allocate space for the wide char strings */ psrc = pdst = extra = NULL; mdst = NULL; - if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL) + if ((psrc = calloc(mbslength + 1, sizeof(*psrc))) == NULL) return -1; - if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL) + if ((pdst = calloc((4 * mbslength) + 1, sizeof(*pdst))) == NULL) goto out; if (*mbdstp == NULL) { - if ((mdst = calloc((4 * mblength) + 1, sizeof(*mdst))) == NULL) + if ((mdst = calloc((4 * mbslength) + 1, sizeof(*mdst))) == NULL) goto out; *mbdstp = mdst; } @@ -451,13 +459,6 @@ * stop at NULs because we may be processing a block of data * that includes NULs. */ - mbslength = (ssize_t)mblength; - /* - * When inputing a single character, must also read in the - * next character for nextc, the look-ahead character. - */ - if (mbslength == 1) - mbslength++; while (mbslength > 0) { /* Convert one multibyte character to wchar_t. */ if (!cerr) @@ -483,6 +484,7 @@ } len = src - psrc; src = psrc; + /* * In the single character input case, we will have actually * processed two characters, c and nextc. Reset len back to