[v2,1/2] readline: update to 7.0 and move 6.3 to compat package

Submitted by Marcel Lorenz on June 9, 2017, 6:37 a.m.

Details

Message ID 20170609063717.2121-1-marcel.lorenz@ipfire.org
State New
Headers show

Commit Message

Marcel Lorenz June 9, 2017, 6:37 a.m.
Signed-off-by: Marcel Lorenz <marcel.lorenz@ipfire.org>
---
 config/rootfiles/common/readline        |   8 +--
 config/rootfiles/common/readline-compat |   4 ++
 lfs/readline                            |  14 +++--
 lfs/readline-compat                     |  55 ++++++++++++-----
 src/patches/readline/readline70-001     |  57 ++++++++++++++++++
 src/patches/readline/readline70-002     | 103 ++++++++++++++++++++++++++++++++
 src/patches/readline/readline70-003     |  40 +++++++++++++
 7 files changed, 257 insertions(+), 24 deletions(-)
 create mode 100644 src/patches/readline/readline70-001
 create mode 100644 src/patches/readline/readline70-002
 create mode 100644 src/patches/readline/readline70-003

Patch hide | download patch | download mbox

diff --git a/config/rootfiles/common/readline b/config/rootfiles/common/readline
index b2ac26d..412de70 100644
--- a/config/rootfiles/common/readline
+++ b/config/rootfiles/common/readline
@@ -8,11 +8,11 @@ 
 #usr/include/readline/rltypedefs.h
 #usr/include/readline/tilde.h
 #usr/lib/libhistory.so
-usr/lib/libhistory.so.6
-usr/lib/libhistory.so.6.3
+usr/lib/libhistory.so.7
+usr/lib/libhistory.so.7.0
 #usr/lib/libreadline.so
-usr/lib/libreadline.so.6
-usr/lib/libreadline.so.6.3
+usr/lib/libreadline.so.7
+usr/lib/libreadline.so.7.0
 #usr/share/doc/readline
 #usr/share/doc/readline/CHANGES
 #usr/share/doc/readline/INSTALL
diff --git a/config/rootfiles/common/readline-compat b/config/rootfiles/common/readline-compat
index 1ff7325..c1af317 100644
--- a/config/rootfiles/common/readline-compat
+++ b/config/rootfiles/common/readline-compat
@@ -1,4 +1,8 @@ 
 lib/libhistory.so.5
 lib/libhistory.so.5.2
+lib/libhistory.so.6
+lib/libhistory.so.6.3
 lib/libreadline.so.5
 lib/libreadline.so.5.2
+lib/libreadline.so.6
+lib/libreadline.so.6.3
diff --git a/lfs/readline b/lfs/readline
index eb488e3..42a78f5 100644
--- a/lfs/readline
+++ b/lfs/readline
@@ -1,7 +1,7 @@ 
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+# Copyright (C) 2017  IPFire Team  <info@ipfire.org>                          #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -24,7 +24,7 @@ 
 
 include Config
 
-VER        = 6.3
+VER        = 7.0
 
 THISAPP    = readline-$(VER)
 DL_FILE    = $(THISAPP).tar.gz
@@ -40,7 +40,7 @@  objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_MD5 = 33c8fb279e981274f485fd91da77e94a
+$(DL_FILE)_MD5 = 205b03a87fc83dab653b628c59b9fc91
 
 install : $(TARGET)
 
@@ -71,10 +71,14 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
 
-	for i in $$(seq 1 6); do \
-		cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/readline/readline63-$$(printf "%03d" "$${i}") || exit 1; \
+	for i in $$(seq 1 3); do \
+		cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/readline/readline70-$$(printf "%03d" "$${i}") || exit 1; \
 	done
 
+	# prevent in some cases to trigger a linking bug in ldconfig
+	cd $(DIR_APP) &&sed -i '/MV.*old/d' Makefile.in
+	cd $(DIR_APP) &&sed -i '/{OLDSUFF}/c:' support/shlib-install
+
 	cd $(DIR_APP) && ./configure --prefix=/usr --disable-static
 	cd $(DIR_APP) && make $(MAKETUNING) SHLIB_LIBS=-lncurses
 	cd $(DIR_APP) && make install
diff --git a/lfs/readline-compat b/lfs/readline-compat
index 2f4388c..127f61d 100644
--- a/lfs/readline-compat
+++ b/lfs/readline-compat
@@ -1,7 +1,7 @@ 
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+# Copyright (C) 2007-2017 IPFire Team  <info@ipfire.org>                      #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -24,9 +24,9 @@ 
 
 include Config
 
-VER        = 5.2
+VER        = 6.3
 
-THISAPP    = readline-$(VER)
+THISAPP    = readline-compat
 DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
@@ -36,11 +36,14 @@  TARGET     = $(DIR_INFO)/$(THISAPP)
 # Top-level Rules
 ###############################################################################
 
-objects = $(DL_FILE)
+objects = readline-6.3.tar.gz \
+	  readline-5.2.tar.gz
 
-$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+readline-6.3.tar.gz = $(DL_FROM)/readline-6.3.tar.gz
+readline-5.2.tar.gz = $(DL_FROM)/readline-5.2.tar.gz
 
-$(DL_FILE)_MD5 = e39331f32ad14009b9ff49cc10c5e751
+readline-6.3.tar.gz_MD5 = 33c8fb279e981274f485fd91da77e94a
+readline-5.2.tar.gz_MD5 = e39331f32ad14009b9ff49cc10c5e751
 
 install : $(TARGET)
 
@@ -69,18 +72,40 @@  $(subst %,%_MD5,$(objects)) :
 
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
-	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+	@rm -rf $(DIR_SRC)/readline-6.3 && cd $(DIR_SRC) && tar zxf $(DIR_DL)/readline-6.3.tar.gz
 
+	# add readline 6.3 patches
+	for i in $$(seq 1 6); do \
+		cd $(DIR_SRC)/readline-6.3 && patch -Np0 < $(DIR_SRC)/src/patches/readline/readline63-$$(printf "%03d" "$${i}") || exit 1; \
+	done
+
+	# build readline 6.3
+	cd $(DIR_SRC)/readline-6.3 && ./configure --prefix=/usr --disable-static
+	cd $(DIR_SRC)/readline-6.3 && make $(MAKETUNING) SHLIB_LIBS=-lncurses
+	rm -rfv /usr/share/readline
+
+	# only install libs
+	cd $(DIR_SRC)/readline-6.3/shlib && install -m 755 libreadline.so.6.3 /lib
+	cd $(DIR_SRC)/readline-6.3/shlib && install -m 755 libhistory.so.6.3 /lib
+	ln -svf libreadline.so.6.3 /lib/libreadline.so.6
+	ln -svf libhistory.so.6.3 /lib/libhistory.so.6
+
+	@rm -rf $(DIR_SRC)/readline-6.3 && cd $(DIR_SRC) && tar zxf $(DIR_DL)/readline-5.2.tar.gz
+
+	# add readline 5.2 patches
 	for i in $$(seq 1 14); do \
-		cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/readline/readline52-$$(printf "%03d" "$${i}") || exit 1; \
+		cd $(DIR_SRC)/readline-5.2 && patch -Np0 < $(DIR_SRC)/src/patches/readline/readline52-$$(printf "%03d" "$${i}") || exit 1; \
 	done
 
-	cd $(DIR_APP) && ./configure --prefix=/usr --libdir=/lib --disable-static
-	cd $(DIR_APP) && make $(MAKETUNING) SHLIB_LIBS=-lncurses
+	# build readline 5.2
+	cd $(DIR_SRC)/readline-5.2 && ./configure --prefix=/usr --libdir=/lib --disable-static
+	cd $(DIR_SRC)/readline-5.2 && make $(MAKETUNING) SHLIB_LIBS=-lncurses
+
+	# only install libs
+	cd $(DIR_SRC)/readline-5.2/shlib && install -m 755 libreadline.so.5.2 /lib
+	cd $(DIR_SRC)/readline-5.2/shlib && install -m 755 libhistory.so.5.2 /lib
+	ln -svf libreadline.so.5.2 /lib/libreadline.so.5
+	ln -svf libhistory.so.5.2 /lib/libhistory.so.5
 
-	cd $(DIR_APP)/shlib && install -m 755 libreadline.so.$(VER) /lib
-	cd $(DIR_APP)/shlib && install -m 755 libhistory.so.$(VER) /lib
-	ln -svf libreadline.so.$(VER) /lib/libreadline.so.5
-	ln -svf libhistory.so.$(VER) /lib/libhistory.so.5
-	@rm -rf $(DIR_APP)
+	@rm -rf $(DIR_SRC)/readline-5.2
 	@$(POSTBUILD)
diff --git a/src/patches/readline/readline70-001 b/src/patches/readline/readline70-001
new file mode 100644
index 0000000..437a440
--- /dev/null
+++ b/src/patches/readline/readline70-001
@@ -0,0 +1,57 @@ 
+			   READLINE PATCH REPORT
+			   =====================
+
+Readline-Release: 7.0
+Patch-ID: readline70-001
+
+Bug-Reported-by:        Sean Zha <freeman_cha@hotmail.com>
+Bug-Reference-ID:       <BN3PR01MB13657D9303EB94BF6E54216E8CCA0@BN3PR01MB1365.prod.exchangelabs.com>
+Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-bash/2016-09/msg00107.html
+
+Bug-Description:
+
+Readline-7.0 changed the way the history list is initially allocated to reduce
+the number of reallocations and copies.  Users who set the readline
+history-size variable to a very large number to essentially unlimit the size
+of the history list will get memory allocation errors 
+
+Patch (apply with `patch -p0'):
+
+*** ../readline-7.0/history.c	2015-12-28 13:50:31.000000000 -0500
+--- 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;
+
+*** ../readline-7.0/patchlevel	2013-11-15 08:11:11.000000000 -0500
+--- patchlevel	2014-03-21 08:28:40.000000000 -0400
+***************
+*** 1,3 ****
+  # Do not edit -- exists only for use by patch
+  
+! 0
+--- 1,3 ----
+  # Do not edit -- exists only for use by patch
+  
+! 1
diff --git a/src/patches/readline/readline70-002 b/src/patches/readline/readline70-002
new file mode 100644
index 0000000..ac76dae
--- /dev/null
+++ b/src/patches/readline/readline70-002
@@ -0,0 +1,103 @@ 
+			   READLINE PATCH REPORT
+			   =====================
+
+Readline-Release: 7.0
+Patch-ID: readline70-002
+
+Bug-Reported-by:	Hong Cho <hong.cho@citrix.com>
+Bug-Reference-ID:	<c30b5fe62b2543af8297e47ca487c29c@SJCPEX02CL02.citrite.net>
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-readline/2016-12/msg00002.html
+
+Bug-Description:
+
+There is a race condition in add_history() that can be triggered by a fatal
+signal arriving between the time the history length is updated and the time
+the history list update is completed. A later attempt to reference an
+invalid history entry can cause a crash.
+
+Patch (apply with `patch -p0'):
+
+*** ../readline-7.0-patched/history.c	2016-11-11 13:42:49.000000000 -0500
+--- history.c	2016-12-05 10:37:51.000000000 -0500
+***************
+*** 280,283 ****
+--- 280,284 ----
+  {
+    HIST_ENTRY *temp;
++   int new_length;
+  
+    if (history_stifled && (history_length == history_max_entries))
+***************
+*** 296,306 ****
+        /* Copy the rest of the entries, moving down one slot.  Copy includes
+  	 trailing NULL.  */
+- #if 0
+-       for (i = 0; i < history_length; i++)
+- 	the_history[i] = the_history[i + 1];
+- #else
+        memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
+- #endif
+  
+        history_base++;
+      }
+--- 297,303 ----
+        /* Copy the rest of the entries, moving down one slot.  Copy includes
+  	 trailing NULL.  */
+        memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
+  
++       new_length = history_length;
+        history_base++;
+      }
+***************
+*** 316,320 ****
+  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
+  	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
+! 	  history_length = 1;
+  	}
+        else
+--- 313,317 ----
+  	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
+  	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
+! 	  new_length = 1;
+  	}
+        else
+***************
+*** 326,330 ****
+  		xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
+  	    }
+! 	  history_length++;
+  	}
+      }
+--- 323,327 ----
+  		xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
+  	    }
+! 	  new_length = history_length + 1;
+  	}
+      }
+***************
+*** 332,337 ****
+    temp = alloc_history_entry ((char *)string, hist_inittime ());
+  
+!   the_history[history_length] = (HIST_ENTRY *)NULL;
+!   the_history[history_length - 1] = temp;
+  }
+  
+--- 329,335 ----
+    temp = alloc_history_entry ((char *)string, hist_inittime ());
+  
+!   the_history[new_length] = (HIST_ENTRY *)NULL;
+!   the_history[new_length - 1] = temp;
+!   history_length = new_length;
+  }
+  
+*** ../readline-7.0/patchlevel	2013-11-15 08:11:11.000000000 -0500
+--- patchlevel	2014-03-21 08:28:40.000000000 -0400
+***************
+*** 1,3 ****
+  # Do not edit -- exists only for use by patch
+  
+! 1
+--- 1,3 ----
+  # Do not edit -- exists only for use by patch
+  
+! 2
diff --git a/src/patches/readline/readline70-003 b/src/patches/readline/readline70-003
new file mode 100644
index 0000000..a19cae6
--- /dev/null
+++ b/src/patches/readline/readline70-003
@@ -0,0 +1,40 @@ 
+			   READLINE PATCH REPORT
+			   =====================
+
+Readline-Release: 7.0
+Patch-ID: readline70-003
+
+Bug-Reported-by:	Frédéric Brière <fbriere@fbriere.net>
+Bug-Reference-ID:	<20170120180724.7ydq7fb2hsp366dj@fabul.fbriere.net>
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-readline/2017-01/msg00002.html
+
+Bug-Description:
+
+Readline-7.0 uses pselect(2) to allow readline to handle signals that do not
+interrupt read(2), such as SIGALRM, before reading another character.  The
+signal mask used in the pselect call did not take into account signals the
+calling application blocked before calling readline().
+
+Patch (apply with `patch -p0'):
+
+*** ../readline-7.0-patched/input.c	2016-08-30 10:21:47.000000000 -0400
+--- input.c	2017-01-23 10:21:56.000000000 -0500
+***************
+*** 514,517 ****
+--- 514,518 ----
+  #if defined (HAVE_PSELECT)
+        sigemptyset (&empty_set);
++       sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &empty_set);
+        FD_ZERO (&readfds);
+        FD_SET (fileno (stream), &readfds);
+*** ../readline-7.0/patchlevel	2013-11-15 08:11:11.000000000 -0500
+--- patchlevel	2014-03-21 08:28:40.000000000 -0400
+***************
+*** 1,3 ****
+  # Do not edit -- exists only for use by patch
+  
+! 2
+--- 1,3 ----
+  # Do not edit -- exists only for use by patch
+  
+! 3