diff -Paur --no-dereference -- libreadline.upstream/configure libreadline/configure
--- libreadline.upstream/configure
+++ libreadline/configure
@@ -2415,7 +2415,7 @@
     i[3456]86-*-beos*)
         cross_cache=${srcdir}/cross-build/x86-beos.cache
         ;;
-    *)  echo "configure: cross-compiling for $host is not supported" >&2
+    *)  #echo "configure: cross-compiling for $host is not supported" >&2
         ;;
     esac
     if test -n "${cross_cache}" && test -r "${cross_cache}"; then
@@ -5194,7 +5194,7 @@
   if test "$cross_compiling" = yes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&5
 $as_echo "$as_me: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&2;}
-     bash_cv_func_sigsetjmp=missing
+     bash_cv_func_sigsetjmp=yes
 
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff -Paur --no-dereference -- libreadline.upstream/history.c libreadline/history.c
--- libreadline.upstream/history.c
+++ libreadline/history.c
@@ -57,6 +57,8 @@
 /* How big to make the_history when we first allocate it. */
 #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
 
@@ -307,7 +309,9 @@
       if (history_size == 0)
 	{
 	  if (history_stifled && history_max_entries > 0)
-	    history_size = history_max_entries + 2;
+	    history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
+				? MAX_HISTORY_INITIAL_SIZE
+				: history_max_entries + 2;
 	  else
 	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
 	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
diff -Paur --no-dereference -- libreadline.upstream/inputrc libreadline/inputrc
--- libreadline.upstream/inputrc
+++ libreadline/inputrc
@@ -0,0 +1,66 @@
+# /etc/inputrc - global inputrc for libreadline
+# See readline(3readline) and `info rluserman' for more information.
+
+# Be 8 bit clean.
+set input-meta on
+set output-meta on
+
+# To allow the use of 8bit-characters like the german umlauts, uncomment
+# the line below. However this makes the meta key not work as a meta key,
+# which is annoying to those which don't need to type in 8-bit characters.
+
+# set convert-meta off
+
+# try to enable the application keypad when it is called.  Some systems
+# need this to enable the arrow keys.
+# set enable-keypad on
+
+# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys
+
+# do not bell on tab-completion
+# set bell-style none
+# set bell-style visible
+
+# some defaults / modifications for the emacs mode
+$if mode=emacs
+
+# allow the use of the Home/End keys
+"\e[1~": beginning-of-line
+"\e[4~": end-of-line
+
+# allow the use of the Delete/Insert keys
+"\e[3~": delete-char
+"\e[2~": quoted-insert
+
+# mappings for "page up" and "page down" to step to the beginning/end
+# of the history
+# "\e[5~": beginning-of-history
+# "\e[6~": end-of-history
+
+# alternate mappings for "page up" and "page down" to search the history
+# "\e[5~": history-search-backward
+# "\e[6~": history-search-forward
+
+# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
+"\e[1;5C": forward-word
+"\e[1;5D": backward-word
+"\e[5C": forward-word
+"\e[5D": backward-word
+"\e\e[C": forward-word
+"\e\e[D": backward-word
+
+$if term=rxvt
+"\e[8~": end-of-line
+"\eOc": forward-word
+"\eOd": backward-word
+$endif
+
+# for non RH/Debian xterm, can't hurt for RH/Debian xterm
+# "\eOH": beginning-of-line
+# "\eOF": end-of-line
+
+# for freebsd console
+# "\e[H": beginning-of-line
+# "\e[F": end-of-line
+
+$endif
diff -Paur --no-dereference -- libreadline.upstream/Makefile.in libreadline/Makefile.in
--- libreadline.upstream/Makefile.in
+++ libreadline/Makefile.in
@@ -59,6 +59,7 @@
 includedir = @includedir@
 datadir = @datadir@
 localedir = @localedir@
+sysconfdir = @sysconfdir@
 
 infodir = @infodir@
 
@@ -66,9 +67,6 @@
 
 man3dir = $(mandir)/man3
 
-# Support an alternate destination root directory for package building
-DESTDIR =
-
 # Programs to make tags files.
 ETAGS = etags
 CTAGS = ctags -tw
@@ -220,6 +218,8 @@
 force:
 
 install:	$(INSTALL_TARGETS)
+	mkdir -p $(DESTDIR)$(sysconfdir)
+	$(INSTALL_DATA) inputrc $(DESTDIR)$(sysconfdir)/inputrc
 
 install-headers: installdirs ${INSTALLED_HEADERS}
 	for f in ${INSTALLED_HEADERS}; do \
diff -Paur --no-dereference -- libreadline.upstream/patchlevel libreadline/patchlevel
--- libreadline.upstream/patchlevel
+++ libreadline/patchlevel
@@ -1,3 +1,3 @@
 # Do not edit -- exists only for use by patch
 
-0
+1
diff -Paur --no-dereference -- libreadline.upstream/readline70-001 libreadline/readline70-001
--- libreadline.upstream/readline70-001
+++ libreadline/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 -Paur --no-dereference -- libreadline.upstream/support/config.sub libreadline/support/config.sub
--- libreadline.upstream/support/config.sub
+++ libreadline/support/config.sub
@@ -1356,7 +1356,7 @@
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
 	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* \
+	      | -aos* | -aros* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
