commit:     4b0bd0d1d7636f79c4c1a65ab280c7f9009ff26e
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 10 06:01:14 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 10 06:01:14 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b0bd0d1

sys-libs/readline: add upstream patch for excessive history memory allocs 
#597006

 .../files/readline-7.0-history-alloclist.patch     | 29 ++++++++++++++++++++++
 ...{readline-7.0.ebuild => readline-7.0-r1.ebuild} |  1 +
 2 files changed, 30 insertions(+)

diff --git a/sys-libs/readline/files/readline-7.0-history-alloclist.patch 
b/sys-libs/readline/files/readline-7.0-history-alloclist.patch
new file mode 100644
index 00000000..73faa60
--- /dev/null
+++ b/sys-libs/readline/files/readline-7.0-history-alloclist.patch
@@ -0,0 +1,29 @@
+https://bugs.gentoo.org/597006
+https://lists.gnu.org/archive/html/bug-bash/2016-10/msg00010.html
+
+*** ../bash-4.4/lib/readline/history.c 2015-12-28 13:50:31.000000000 -0500
+--- lib/readline/history.c     2016-09-30 14:28:40.000000000 -0400
+***************
+*** 58,61 ****
+--- 58,63 ----
+  #define DEFAULT_HISTORY_INITIAL_SIZE 502
+  
++ #define MAX_HISTORY_INITIAL_SIZE     8192
++ 
+  /* The number of slots to increase the_history by. */
+  #define DEFAULT_HISTORY_GROW_SIZE 50
+***************
+*** 308,312 ****
+       {
+         if (history_stifled && history_max_entries > 0)
+!          history_size = history_max_entries + 2;
+         else
+           history_size = DEFAULT_HISTORY_INITIAL_SIZE;
+--- 310,316 ----
+       {
+         if (history_stifled && history_max_entries > 0)
+!          history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
+!                              ? MAX_HISTORY_INITIAL_SIZE
+!                              : history_max_entries + 2;
+         else
+           history_size = DEFAULT_HISTORY_INITIAL_SIZE;

diff --git a/sys-libs/readline/readline-7.0.ebuild 
b/sys-libs/readline/readline-7.0-r1.ebuild
similarity index 98%
rename from sys-libs/readline/readline-7.0.ebuild
rename to sys-libs/readline/readline-7.0-r1.ebuild
index 56fddcb..aecaa1c 100644
--- a/sys-libs/readline/readline-7.0.ebuild
+++ b/sys-libs/readline/readline-7.0-r1.ebuild
@@ -54,6 +54,7 @@ src_prepare() {
        epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
        epatch "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
        epatch "${FILESDIR}"/${PN}-7.0-headers.patch
+       epatch "${FILESDIR}"/${PN}-7.0-history-alloclist.patch #597006
 
        # Force ncurses linking. #71420
        # Use pkg-config to get the right values. #457558

Reply via email to