Index: BOOK/final-system/common/readline.xml
===================================================================
--- BOOK/final-system/common/readline.xml	(revision 30f7bcde121cb50cd761a319ca26448ca616ca0f)
+++ BOOK/final-system/common/readline.xml	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
@@ -26,13 +26,18 @@
     <title>Installation of Readline</title>
 
-    <para os="c">Prepare Readline for compilation:</para>
+    <para os="p1">The following patch contains updates from the maintainer. The
+    maintainer of Readline only releases these patches to fix serious issues:</para>
 
-<screen os="d"><userinput>./configure --prefix=/usr --libdir=/lib</userinput></screen>
+<screen os="p2"><userinput>patch -Np1 -i ../&readline-fixes-patch;</userinput></screen>
 
-    <para os="e">Compile the package:</para>
+    <para os="a">Prepare Readline for compilation:</para>
 
-<screen os="f"><userinput>make SHLIB_XLDFLAGS=-lncurses</userinput></screen>
+<screen os="b"><userinput>./configure --prefix=/usr --libdir=/lib</userinput></screen>
 
-    <variablelist os="g">
+    <para os="c">Compile the package:</para>
+
+<screen os="d"><userinput>make SHLIB_XLDFLAGS=-lncurses</userinput></screen>
+
+    <variablelist os="e">
       <title>The meaning of the make option:</title>
 
@@ -46,24 +51,24 @@
     </variablelist>
 
-    <para os="h">This package does not come with a test suite.</para>
+    <para os="f">This package does not come with a test suite.</para>
 
-    <para os="i">Install the package:</para>
+    <para os="g">Install the package:</para>
 
-<screen os="j"><userinput>make install</userinput></screen>
+<screen os="h"><userinput>make install</userinput></screen>
 
-    <para os="k">Give Readline's dynamic libraries more appropriate
+    <para os="i">Give Readline's dynamic libraries more appropriate
     permissions:</para>
 
-<screen os="l"><userinput>chmod -v 755 /lib/lib{readline,history}.so*</userinput></screen>
+<screen os="j"><userinput>chmod -v 755 /lib/lib{readline,history}.so*</userinput></screen>
 
-    <para os="m">Now move the static libraries to a more appropriate location:</para>
+    <para os="k">Now move the static libraries to a more appropriate location:</para>
 
-<screen os="n"><userinput>mv -v /lib/lib{readline,history}.a /usr/lib</userinput></screen>
+<screen os="l"><userinput>mv -v /lib/lib{readline,history}.a /usr/lib</userinput></screen>
 
-    <para os="o">Next, remove the <filename class="extension">.so</filename>
+    <para os="m">Next, remove the <filename class="extension">.so</filename>
     files in <filename class="directory">/lib</filename> and relink them into
     <filename class="directory">/usr/lib</filename>.</para>
 
-<screen os="p"><userinput>rm -v /lib/lib{readline,history}.so
+<screen os="n"><userinput>rm -v /lib/lib{readline,history}.so
 ln -svf ../../lib/libreadline.so.5 /usr/lib/libreadline.so
 ln -svf ../../lib/libhistory.so.5 /usr/lib/libhistory.so</userinput></screen>
Index: BOOK/final-system/multilib/readline-64bit.xml
===================================================================
--- BOOK/final-system/multilib/readline-64bit.xml	(revision 30f7bcde121cb50cd761a319ca26448ca616ca0f)
+++ BOOK/final-system/multilib/readline-64bit.xml	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
@@ -24,8 +24,24 @@
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
     href="readline.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
+    xpointer="xpointer(//*[@os='a'])"/>
+
+<screen os="b"><userinput>CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" \
+   ./configure --prefix=/usr --libdir=/lib64</userinput></screen>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
     xpointer="xpointer(//*[@os='c'])"/>
 
-<screen os="d"><userinput>CC="gcc ${BUILD64}" CXX="g++ ${BUILD64}" \
-   ./configure --prefix=/usr --libdir=/lib64</userinput></screen>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
+    xpointer="xpointer(//*[@os='d'])"/>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
@@ -49,7 +65,5 @@
     xpointer="xpointer(//*[@os='i'])"/>
 
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="readline.xml"
-    xpointer="xpointer(//*[@os='j'])"/>
+<screen os="j"><userinput>chmod -v 755 /lib64/lib{readline,history}.so*</userinput></screen>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
@@ -57,17 +71,11 @@
     xpointer="xpointer(//*[@os='k'])"/>
 
-<screen os="l"><userinput>chmod -v 755 /lib64/lib{readline,history}.so*</userinput></screen>
+<screen os="l"><userinput>mv -v /lib64/lib{readline,history}.a /usr/lib64</userinput></screen>
 
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="readline.xml"
-    xpointer="xpointer(//*[@os='m'])"/>
-
-<screen os="n"><userinput>mv -v /lib64/lib{readline,history}.a /usr/lib64</userinput></screen>
-
-    <para os="o">Next, remove the <filename class="extension">.so</filename>
+    <para os="m">Next, remove the <filename class="extension">.so</filename>
     files in <filename class="directory">/lib64</filename> and relink them into
     <filename class="directory">/usr/lib64</filename>.</para>
 
-<screen os="p"><userinput>rm -v /lib64/lib{readline,history}.so
+<screen os="n"><userinput>rm -v /lib64/lib{readline,history}.so
 ln -svf ../../lib64/libreadline.so.5 /usr/lib64/libreadline.so
 ln -svf ../../lib64/libhistory.so.5 /usr/lib64/libhistory.so</userinput></screen>
Index: BOOK/final-system/multilib/readline-n32.xml
===================================================================
--- BOOK/final-system/multilib/readline-n32.xml	(revision 30f7bcde121cb50cd761a319ca26448ca616ca0f)
+++ BOOK/final-system/multilib/readline-n32.xml	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
@@ -25,12 +25,32 @@
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
     href="readline.xml"
-    xpointer="xpointer(//*[@os='c'])"/>
+    xpointer="xpointer(//*[@os='p1'])"/>
 
-<screen os="d"><userinput>CC="gcc ${BUILDN32}" CXX="g++ ${BUILDN32}" \
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
+    xpointer="xpointer(//*[@os='a'])"/>
+
+<screen os="b"><userinput>CC="gcc ${BUILDN32}" CXX="g++ ${BUILDN32}" \
    ./configure --prefix=/usr --libdir=/lib32</userinput></screen>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
     href="readline.xml"
+    xpointer="xpointer(//*[@os='c'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
+    xpointer="xpointer(//*[@os='d'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
     xpointer="xpointer(//*[@os='e'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="readline.xml"
+    xpointer="xpointer(//*[@os='f'])"/>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
@@ -46,7 +66,5 @@
     xpointer="xpointer(//*[@os='i'])"/>
 
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="readline.xml"
-    xpointer="xpointer(//*[@os='j'])"/>
+<screen os="j"><userinput>chmod -v 755 /lib32/lib{readline,history}.so*</userinput></screen>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
@@ -54,18 +72,11 @@
     xpointer="xpointer(//*[@os='k'])"/>
 
+<screen os="l"><userinput>mv -v /lib32/lib{readline,history}.a /usr/lib32</userinput></screen>
 
-<screen os="k"><userinput>chmod -v 755 /lib32/lib{readline,history}.so*</userinput></screen>
-
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="readline.xml"
-    xpointer="xpointer(//*[@os='m'])"/>
-
-<screen os="m"><userinput>mv -v /lib32/lib{readline,history}.a /usr/lib32</userinput></screen>
-
-    <para os="n">Next, remove the <filename class="extension">.so</filename>
+    <para os="m">Next, remove the <filename class="extension">.so</filename>
     files in <filename class="directory">/lib32</filename> and relink them into
     <filename class="directory">/usr/lib32</filename>.</para>
 
-<screen os="o"><userinput>rm -v /lib32/lib{readline,history}.so
+<screen os="n"><userinput>rm -v /lib32/lib{readline,history}.so
 ln -svf ../../lib32/libreadline.so.5 /usr/lib32/libreadline.so
 ln -svf ../../lib32/libhistory.so.5 /usr/lib32/libhistory.so</userinput></screen>
Index: BOOK/final-system/multilib/readline.xml
===================================================================
--- BOOK/final-system/multilib/readline.xml	(revision 30f7bcde121cb50cd761a319ca26448ca616ca0f)
+++ BOOK/final-system/multilib/readline.xml	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
@@ -25,8 +25,24 @@
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
     href="../common/readline.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/readline.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/readline.xml"
+    xpointer="xpointer(//*[@os='a'])"/>
+
+<screen os="b"><userinput>CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" \
+   ./configure --prefix=/usr --libdir=/lib</userinput></screen>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/readline.xml"
     xpointer="xpointer(//*[@os='c'])"/>
 
-<screen os="d"><userinput>CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" \
-   ./configure --prefix=/usr --libdir=/lib</userinput></screen>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/readline.xml"
+    xpointer="xpointer(//*[@os='d'])"/>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
@@ -69,12 +85,4 @@
     href="../common/readline.xml"
     xpointer="xpointer(//*[@os='n'])"/>
-
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="../common/readline.xml"
-    xpointer="xpointer(//*[@os='o'])"/>
-
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
-    href="../common/readline.xml"
-    xpointer="xpointer(//*[@os='p'])"/>
   </sect2>
 
Index: BOOK/introduction/common/changelog.xml
===================================================================
--- BOOK/introduction/common/changelog.xml	(revision 30f7bcde121cb50cd761a319ca26448ca616ca0f)
+++ BOOK/introduction/common/changelog.xml	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
@@ -46,4 +46,7 @@
           <para>[jim] - Updated to Linux Headers 2.6.19.1-12122006.</para>
         </listitem>
+        <listitem>
+          <para>[jim] - Added Readline Upstream Patch.</para>
+        </listitem>
       </itemizedlist>
     </listitem>
Index: BOOK/materials/common/patches.xml
===================================================================
--- BOOK/materials/common/patches.xml	(revision 30f7bcde121cb50cd761a319ca26448ca616ca0f)
+++ BOOK/materials/common/patches.xml	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
@@ -209,4 +209,13 @@
 
     <varlistentry>
+      <term>Readline Fixes - <token>&readline-fixes-patch-size;</token>:</term>
+      <listitem>
+        <para>Download: <ulink
+        url="&patches-root;&readline-fixes-patch;"/></para>
+        <para>MD5 sum: <literal>&readline-fixes-patch-md5;</literal></para>
+      </listitem>
+    </varlistentry>
+
+    <varlistentry>
       <term>Shadow Useradd Patch - <token>&shadow-useradd_fix-patch-size;</token>:</term>
       <listitem>
Index: BOOK/patches.ent
===================================================================
--- BOOK/patches.ent	(revision 30f7bcde121cb50cd761a319ca26448ca616ca0f)
+++ BOOK/patches.ent	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
@@ -89,7 +89,7 @@
 <!ENTITY perl-libc-patch-size "4 KB">
 
-<!ENTITY readline-fixes-patch "readline-&readline-version;-fixes-3.patch">
-<!ENTITY readline-fixes-patch-md5 "e30963cd5c6f6a11a23344af36cfa38c">
-<!ENTITY readline-fixes-patch-size "2.1 KB">
+<!ENTITY readline-fixes-patch "readline-&readline-version;-fixes-1.patch">
+<!ENTITY readline-fixes-patch-md5 "c3483d9d4e44614a740e190d25100cdf">
+<!ENTITY readline-fixes-patch-size "4 KB">
 
 <!ENTITY shadow-useradd_fix-patch "shadow-&shadow-version;-useradd_fix-1.patch">
Index: patches/readline-5.2-fixes-1.patch
===================================================================
--- patches/readline-5.2-fixes-1.patch	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
+++ patches/readline-5.2-fixes-1.patch	(revision 001becd50a623fb151780cad203b9a3d8c1783ee)
@@ -0,0 +1,19 @@
+Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
+Date: 2006-12-12
+Initial Package Version: 5.2
+Origin: ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches
+Upstream Status: From Upstream
+Description: Contains patches 001 from upstream
+
+diff -Naur readline-5.2.orig/display.c readline-5.2/display.c
+--- readline-5.2.orig/display.c	2006-09-14 11:20:12.000000000 -0700
++++ readline-5.2/display.c	2006-12-12 14:57:06.000000000 -0800
+@@ -2380,6 +2380,8 @@
+ 
+   if (end <= start)
+     return 0;
++  if (MB_CUR_MAX == 1 || rl_byte_oriented)
++    return (end - start);
+ 
+   memset (&ps, 0, sizeof (mbstate_t));
+ 
