From 43199dd206f0011d314f08e0e88e72e09b80e86d Mon Sep 17 00:00:00 2001 From: Justin Lecher Date: Sat, 23 Nov 2013 08:38:24 +0000 Subject: dev-tcltk/tclreadline: Add multiple fixes imported from debian and kindly provided by Quentin Minster, #440648 (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key B9D4F231BD1558AB!) --- dev-tcltk/tclreadline/ChangeLog | 13 ++- .../files/tclreadline-2.1.0-alloc-free.patch | 121 +++++++++++++++++++ .../tclreadline/files/tclreadline-2.1.0-gold.patch | 2 +- .../tclreadline-2.1.0-rl-executing-macro.patch | 128 +++++++++++++++++++++ .../tclreadline-2.1.0-rl-history-expand.patch | 35 ++++++ .../files/tclreadline-2.1.0-rl-prompt.patch | 12 ++ dev-tcltk/tclreadline/tclreadline-2.1.0-r4.ebuild | 69 +++++++++++ 7 files changed, 378 insertions(+), 2 deletions(-) create mode 100644 dev-tcltk/tclreadline/files/tclreadline-2.1.0-alloc-free.patch create mode 100644 dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-executing-macro.patch create mode 100644 dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-history-expand.patch create mode 100644 dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-prompt.patch create mode 100644 dev-tcltk/tclreadline/tclreadline-2.1.0-r4.ebuild (limited to 'dev-tcltk') diff --git a/dev-tcltk/tclreadline/ChangeLog b/dev-tcltk/tclreadline/ChangeLog index 56af51f58f66..f140a551a3d7 100644 --- a/dev-tcltk/tclreadline/ChangeLog +++ b/dev-tcltk/tclreadline/ChangeLog @@ -1,6 +1,17 @@ # ChangeLog for dev-tcltk/tclreadline # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-tcltk/tclreadline/ChangeLog,v 1.25 2013/11/17 09:31:58 jlec Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-tcltk/tclreadline/ChangeLog,v 1.26 2013/11/23 08:38:24 jlec Exp $ + +*tclreadline-2.1.0-r4 (23 Nov 2013) + + 23 Nov 2013; Justin Lecher +tclreadline-2.1.0-r4.ebuild, + +files/tclreadline-2.1.0-alloc-free.patch, + files/tclreadline-2.1.0-gold.patch, + +files/tclreadline-2.1.0-rl-executing-macro.patch, + +files/tclreadline-2.1.0-rl-history-expand.patch, + +files/tclreadline-2.1.0-rl-prompt.patch: + Add multiple fixes imported from debian and kindly provided by Quentin + Minster, #440648 *tclreadline-2.1.0-r3 (17 Nov 2013) diff --git a/dev-tcltk/tclreadline/files/tclreadline-2.1.0-alloc-free.patch b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-alloc-free.patch new file mode 100644 index 000000000000..6694c29f6042 --- /dev/null +++ b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-alloc-free.patch @@ -0,0 +1,121 @@ +diff -ur a/tclreadline.c b/tclreadline.c +--- a/tclreadline.c 2000-09-20 19:44:34.000000000 +0200 ++++ b/tclreadline.c 2013-11-18 10:35:13.889610060 +0100 +@@ -343,7 +343,9 @@ + return TCL_ERROR; + } else if (3 == objc) { +- if (tclrl_custom_completer) ++ if (tclrl_custom_completer) { +- FREE(tclrl_custom_completer); ++ free(tclrl_custom_completer); ++ tclrl_custom_completer = NULL; ++ } + if (!blank_line(Tcl_GetStringFromObj(objv[2], 0))) + tclrl_custom_completer = + stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0))); +@@ -378,7 +380,9 @@ + return TCL_ERROR; + } else if (3 == objc) { +- if (tclrl_eof_string) ++ if (tclrl_eof_string) { +- FREE(tclrl_eof_string); ++ free(tclrl_eof_string); ++ tclrl_eof_string = NULL; ++ } + if (!blank_line(Tcl_GetStringFromObj(objv[2], 0))) + tclrl_eof_string = + stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0))); +@@ -506,10 +510,16 @@ + if (status >= 1) { + /* TODO: make this a valid tcl output */ + printf("%s\n", expansion); ++ free(ptr); ++ free(expansion); ++ return; + } else if (-1 == status) { + Tcl_AppendResult + (tclrl_interp, "error in history expansion\n", (char*) NULL); + TclReadlineTerminate(TCL_ERROR); ++ free(ptr); ++ free(expansion); ++ return; + } + /** + * TODO: status == 2 ... +@@ -544,8 +554,8 @@ + * tell the calling routines to terminate. + */ + TclReadlineTerminate(LINE_COMPLETE); +- FREE(ptr); +- FREE(expansion); ++ free(ptr); ++ free(expansion); + } + } + +@@ -673,7 +683,7 @@ + strcpy(rl_line_buffer, expansion); + rl_end = strlen(expansion); + rl_point += strlen(expansion) - oldlen; +- FREE(expansion); ++ free(expansion); + /* + * TODO: + * because we return 0 == matches, +@@ -682,7 +690,8 @@ + */ + return matches; + } +- FREE(expansion); ++ free(expansion); ++ expansion = NULL; + } + + if (tclrl_custom_completer) { +@@ -699,15 +710,19 @@ + state = Tcl_VarEval(tclrl_interp, tclrl_custom_completer, + " \"", quoted_text, "\" ", start_s, " ", end_s, + " \"", quoted_rl_line_buffer, "\"", (char*) NULL); +- FREE(quoted_text); +- FREE(quoted_rl_line_buffer); + if (TCL_OK != state) { + Tcl_AppendResult (tclrl_interp, " `", tclrl_custom_completer, + " \"", quoted_text, "\" ", start_s, " ", end_s, + " \"", quoted_rl_line_buffer, "\"' failed.", (char*) NULL); + TclReadlineTerminate(state); ++ free(quoted_text); ++ free(quoted_rl_line_buffer); + return matches; + } ++ free(quoted_text); ++ quoted_text = NULL; ++ free(quoted_rl_line_buffer); ++ quoted_rl_line_buffer = NULL; + obj = Tcl_GetObjResult(tclrl_interp); + status = Tcl_ListObjGetElements(tclrl_interp, obj, &objc, &objv); + if (TCL_OK != status) +@@ -715,12 +732,12 @@ + + if (objc) { + int i, length; +- matches = (char**) MALLOC(sizeof(char*) * (objc + 1)); ++ matches = (char**) malloc(sizeof(char*) * (objc + 1)); + for (i = 0; i < objc; i++) { + matches[i] = strdup(Tcl_GetStringFromObj(objv[i], &length)); + if (1 == objc && !strlen(matches[i])) { +- FREE(matches[i]); ++ free(matches[i]); +- FREE(matches); ++ free(matches); + Tcl_ResetResult(tclrl_interp); /* clear result space */ + return (char**) NULL; + } +@@ -735,7 +752,7 @@ + */ + if (2 == objc && !strlen(matches[1])) { + i--; +- FREE(matches[1]); ++ free(matches[1]); + rl_completion_append_character = '\0'; + } + diff --git a/dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch index 8cfb5b43a742..5550c89879c8 100644 --- a/dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch +++ b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-gold.patch @@ -9,7 +9,7 @@ index 68d78f1..03dbf06 100644 INCLUDES = -I$(TCL_INCLUDE_DIR) -I$(READLINE_INCLUDE_DIR) ## libtclreadline_la_LIBADD = $(LIBS) -+libtclreadline_la_LIBADD = -ltcl ++libtclreadline_la_LIBADD = $(TCL_LIB_SPEC) -lreadline libtclreadline_la_LDFLAGS = -release $(MAJOR).$(MINOR).$(PATCHLEVEL) tclrldir = @TCLRL_DIR@ diff --git a/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-executing-macro.patch b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-executing-macro.patch new file mode 100644 index 000000000000..683622e0d54c --- /dev/null +++ b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-executing-macro.patch @@ -0,0 +1,128 @@ +diff -ur a/configure.ac b/configure.ac +--- a/configure.ac 2000-12-08 01:45:45.000000000 +0100 ++++ b/configure.ac 2013-11-15 13:37:36.490520853 +0100 +@@ -182,29 +182,36 @@ + [ --with-readline-library=DIR + lib spec to readline (e.g. '-L/usr/local/lib -lreadline')], + LIBS="$LIBS $withval", +- AC_CHECK_LIB(readline, rl_callback_read_char, , +- AC_MSG_RESULT([ +- Your readline version does not support readline's alternate interface. +- Please upgrade to readline >= 2.2 and retry. +- ]) +- exit ++ AC_SEARCH_LIBS(rl_callback_read_char, readline, , ++ AC_MSG_RESULT([ ++ Your readline version does not support readline's alternate interface. ++ Please upgrade to readline >= 2.2 and retry. ++ ]) ++ exit + ) + ) + + + +-# check for readline's (macro.c) private variable +-# _rl_executing_macro. ++# check for readline's rl_executing_macro ++# (could be macro.c's private variable _rl_executing_macro). + +-AC_MSG_CHECKING([for _rl_executing_macro in -lreadline]) +-AC_TRY_LINK(,[ ++AC_CHECK_DECL(rl_executing_macro ++, AC_DEFINE(EXECUTING_MACRO_NAME, rl_executing_macro, ++ [ Define the name of the executing macro variable in libreadline. ]) ++, AC_MSG_CHECKING([for _rl_executing_macro in -lreadline]) ++ AC_TRY_LINK(,[ + extern char* _rl_executing_macro; + _rl_executing_macro = (char*) 0; +-], +- AC_MSG_RESULT(yes); ++ ] ++ , AC_MSG_RESULT(yes) + AC_DEFINE(EXECUTING_MACRO_HACK, 1, +- [ Define if _rl_executing_macro is resolved in libreadline. ]), +- AC_MSG_RESULT(no)) ++ [ Define if EXECUTING_MACRO_NAME is resolved in libreadline. ]) ++ AC_DEFINE(EXECUTING_MACRO_NAME, _rl_executing_macro, ++ [ Define the name of the executing macro variable in libreadline. ]) ++ , AC_MSG_RESULT(no)) ++, [AC_INCLUDES_DEFAULT ++#include "$READLINE_INCLUDE_DIR/readline.h"]) + + # check for readline's rl_cleanup_after_signal + +diff -ur a/tclreadline.c b/tclreadline.c +--- a/tclreadline.c 2000-09-20 19:44:34.000000000 +0200 ++++ b/tclreadline.c 2013-11-15 11:09:42.269771129 +0100 +@@ -41,7 +41,7 @@ + * We need it here to decide, if we should read more + * characters from a macro. Dirty, but it should work. + */ +-extern char* _rl_executing_macro; ++extern char* EXECUTING_MACRO_NAME; + #endif + + #include "tclreadline.h" +@@ -249,14 +249,14 @@ + tclrl_state = LINE_PENDING; + + while (!TclReadlineLineComplete()) { +-#ifdef EXECUTING_MACRO_HACK ++#ifdef EXECUTING_MACRO_NAME + /** + * check first, if more characters are + * available from _rl_executing_macro, + * because Tcl_DoOneEvent() will (naturally) + * not detect this `event'. + */ +- if (_rl_executing_macro) ++ if (EXECUTING_MACRO_NAME) + TclReadlineReadHandler((ClientData) NULL, TCL_READABLE); + else + #endif +@@ -468,17 +468,17 @@ + TclReadlineReadHandler(ClientData clientData, int mask) + { + if (mask & TCL_READABLE) { +-#ifdef EXECUTING_MACRO_HACK ++#ifdef EXECUTING_MACRO_NAME + do { + #endif + rl_callback_read_char(); +-#ifdef EXECUTING_MACRO_HACK ++#ifdef EXECUTING_MACRO_NAME + /** + * check, if we're inside a macro and + * if so, read all macro characters + * until the next eol. + */ +- } while (_rl_executing_macro && !TclReadlineLineComplete()); ++ } while (EXECUTING_MACRO_NAME && !TclReadlineLineComplete()); + #endif + } + } +@@ -517,12 +517,12 @@ + + Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL); + +-#ifdef EXECUTING_MACRO_HACK ++#ifdef EXECUTING_MACRO_NAME + /** + * don't stuff macro lines + * into readline's history. + */ +- if(!_rl_executing_macro) { ++ if(!EXECUTING_MACRO_NAME) { + #endif + /** + * don't stuff empty lines +@@ -537,7 +537,7 @@ + if (tclrl_last_line) + free(tclrl_last_line); + tclrl_last_line = strdup(expansion); +-#ifdef EXECUTING_MACRO_HACK ++#ifdef EXECUTING_MACRO_NAME + } + #endif + /** diff --git a/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-history-expand.patch b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-history-expand.patch new file mode 100644 index 000000000000..6e4d5270e41a --- /dev/null +++ b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-history-expand.patch @@ -0,0 +1,35 @@ +diff -ur a/tclreadline.c b/tclreadline.c +--- a/tclreadline.c 2013-11-16 20:14:28.876272386 +0100 ++++ b/tclreadline.c 2013-11-16 20:14:24.191390550 +0100 +@@ -503,25 +503,22 @@ + char* expansion = (char*) NULL; + int status = history_expand(ptr, &expansion); + +- if (status >= 1) { ++ if (status >= 2) { + /* TODO: make this a valid tcl output */ + printf("%s\n", expansion); + free(ptr); + free(expansion); + return; +- } else if (-1 == status) { ++ } else if (status <= -1) { + Tcl_AppendResult +- (tclrl_interp, "error in history expansion\n", (char*) NULL); ++ (tclrl_interp, "error in history expansion: ", expansion, "\n", (char*) NULL); + TclReadlineTerminate(TCL_ERROR); + free(ptr); + free(expansion); + return; +- } +- /** +- * TODO: status == 2 ... +- */ +- +- Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL); ++ } else { ++ Tcl_AppendResult(tclrl_interp, expansion, (char*) NULL); ++ } + + #ifdef EXECUTING_MACRO_HACK + /** diff --git a/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-prompt.patch b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-prompt.patch new file mode 100644 index 000000000000..a10a404100d3 --- /dev/null +++ b/dev-tcltk/tclreadline/files/tclreadline-2.1.0-rl-prompt.patch @@ -0,0 +1,12 @@ +diff -ur a/tclreadline.c b/tclreadline.c +--- a/tclreadline.c 2013-11-16 20:14:28.876272386 +0100 ++++ b/tclreadline.c 2013-11-16 20:37:47.455986902 +0100 +@@ -234,7 +234,7 @@ + + rl_callback_handler_install( + objc == 3 ? Tcl_GetStringFromObj(objv[2], 0) +- : "%", TclReadlineLineCompleteHandler); ++ : "% ", TclReadlineLineCompleteHandler); + + Tcl_CreateFileHandler(0, TCL_READABLE, + TclReadlineReadHandler, (ClientData) NULL); diff --git a/dev-tcltk/tclreadline/tclreadline-2.1.0-r4.ebuild b/dev-tcltk/tclreadline/tclreadline-2.1.0-r4.ebuild new file mode 100644 index 000000000000..d2fc83fbe418 --- /dev/null +++ b/dev-tcltk/tclreadline/tclreadline-2.1.0-r4.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-tcltk/tclreadline/tclreadline-2.1.0-r4.ebuild,v 1.1 2013/11/23 08:38:24 jlec Exp $ + +EAPI=5 + +AUTOTOOLS_AUTORECONF=true + +inherit autotools-utils multilib toolchain-funcs + +DEBIAN_PATCH=12 + +DESCRIPTION="Readline extension to TCL" +HOMEPAGE="http://tclreadline.sf.net/" +SRC_URI=" + mirror://sourceforge/${PN}/${P}.tar.gz + mirror://debian/pool/main/t/${PN}/${PN}_${PV}-${DEBIAN_PATCH}.debian.tar.gz" + +SLOT="0" +LICENSE="BSD" +KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux" +IUSE="static-libs" + +DEPEND=" + dev-lang/tcl + sys-libs/readline" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${P}-gold.patch + "${FILESDIR}"/${P}-alloc-free.patch + "${FILESDIR}"/${P}-rl-executing-macro.patch + "${FILESDIR}"/${P}-rl-history-expand.patch + "${FILESDIR}"/${P}-rl-prompt.patch + "${WORKDIR}"/debian/patches/complete_nontcl.patch + "${WORKDIR}"/debian/patches/completion_matches.patch + "${WORKDIR}"/debian/patches/completion_pbug.patch + "${WORKDIR}"/debian/patches/kfreebsd.patch + "${WORKDIR}"/debian/patches/link.patch + "${WORKDIR}"/debian/patches/manpage.patch + "${WORKDIR}"/debian/patches/memuse.patch +# "${WORKDIR}"/debian/patches/tclrldir.patch + "${WORKDIR}"/debian/patches/tclshpath.patch + "${WORKDIR}"/debian/patches/tinfo.patch + "${WORKDIR}"/debian/patches/varnames.patch + + ) + +src_prepare() { + sed \ + -e "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/" \ + -e "/^TCLRL_LIBDIR/s:lib:$(get_libdir):g" \ + -i configure.in || die + mv configure.{in,ac} || die + sed \ + -e 's:configure.in:configure.ac:g' \ + -i "${WORKDIR}"/debian/patches/* || die + autotools-utils_src_prepare +} + +src_configure() { + local myeconfargs=( + --with-tcl="${EPREFIX}/usr/$(get_libdir)" + --with-tcl-includes="${EPREFIX}/usr/include" + --with-readline-includes="${EPREFIX}/usr/include" + --with-readline-library="-lreadline" + ) + autotools-utils_src_configure +} -- cgit v1.2.3-65-gdbad