Index: BOOK/final-system/common/tar.xml
===================================================================
--- BOOK/final-system/common/tar.xml	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/final-system/common/tar.xml	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -25,4 +25,9 @@
   <sect2 role="installation">
     <title>Installation of Tar</title>
+
+    <para os="p1">The following patch contains a fix for an issue that may occur
+    when tar calls an outside compression utility like bzip2:</para>
+
+<screen os="p2"><userinput>patch -Np1 -i ../&tar-revert_pipe_drain-patch;</userinput></screen>
 
     <para os="a">Prepare Tar for compilation:</para>
Index: BOOK/final-system/multilib/tar.xml
===================================================================
--- BOOK/final-system/multilib/tar.xml	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/final-system/multilib/tar.xml	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -21,4 +21,12 @@
   <sect2 role="installation">
     <title>Installation of Tar</title>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
Index: BOOK/introduction/common/changelog.xml
===================================================================
--- BOOK/introduction/common/changelog.xml	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/introduction/common/changelog.xml	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -47,4 +47,8 @@
           <para>[Jim] - Added patch that will fix a build issue with Kbd. The patch is
 		for the linux-headers in final-system.</para>
+        </listitem>
+        <listitem>
+          <para>[Jim] - Added patch for TAR. Could cause an issue when extracting tar 
+                with bzip2 archives.</para>
         </listitem>
       </itemizedlist>
Index: BOOK/materials/common/patches.xml
===================================================================
--- BOOK/materials/common/patches.xml	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/materials/common/patches.xml	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -173,4 +173,13 @@
 
     <varlistentry>
+      <term>Tar Revert Pipe Drain Patch - <token>&tar-revert_pipe_drain-patch-size;</token>:</term>
+      <listitem>
+        <para>Download: <ulink
+        url="&patches-root;&tar-revert_pipe_drain-patch;"/></para>
+        <para>MD5 sum: <literal>&tar-revert_pipe_drain-patch-md5;</literal></para>
+      </listitem>
+    </varlistentry>
+
+    <varlistentry>
       <term>Vim Branch Update Patch - <token>&vim-branch_update-patch-size;</token>:</term>
       <listitem>
Index: BOOK/patches.ent
===================================================================
--- BOOK/patches.ent	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/patches.ent	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -77,4 +77,8 @@
 <!ENTITY readline-fixes-patch-size "24 KB">
 
+<!ENTITY tar-revert_pipe_drain-patch "tar-&tar-version;-revert_pipe_drain-1.patch">
+<!ENTITY tar-revert_pipe_drain-patch-md5 "fd0543b6c8b4c033af0b702f28ec6608">
+<!ENTITY tar-revert_pipe_drain-patch-size "4 KB">
+
 <!ENTITY vim-branch_update-patch "vim-&vim-version;-branch_update-3.patch">
 <!ENTITY vim-branch_update-patch-md5 "8a08f1a9562183a0214595c915565078">
Index: BOOK/temp-system/common/tar.xml
===================================================================
--- BOOK/temp-system/common/tar.xml	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/temp-system/common/tar.xml	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -22,4 +22,12 @@
   <sect2 role="installation">
     <title>Installation of Tar</title>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../../final-system/common/tar.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../../final-system/common/tar.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
 
     <para os="c1">TAR utilizes UTF-8 capability, without the following
Index: BOOK/temp-system/multilib/tar.xml
===================================================================
--- BOOK/temp-system/multilib/tar.xml	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/temp-system/multilib/tar.xml	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -22,4 +22,12 @@
   <sect2 role="installation">
     <title>Installation of Tar</title>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
Index: BOOK/temp-system/native/tar.xml
===================================================================
--- BOOK/temp-system/native/tar.xml	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/temp-system/native/tar.xml	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -23,8 +23,19 @@
     <title>Installation of Tar</title>
 
-    <para os="c1">TAR utilizes UTF-8 capability, without the following
-    command the UTF-8 sections of the build will fail:</para>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
 
-<screen os="c2"><userinput>echo "gl_cv_func_wcwidth_works=yes" &gt;&gt; config.cache</userinput></screen>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='c1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='c2'])"/>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
Index: BOOK/temp-system/native64/tar.xml
===================================================================
--- BOOK/temp-system/native64/tar.xml	(revision f6c1ef8f762dcb6be8d345c762ab71fd14564646)
+++ BOOK/temp-system/native64/tar.xml	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -22,4 +22,12 @@
   <sect2 role="installation">
     <title>Installation of Tar</title>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='p1'])"/>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/tar.xml"
+    xpointer="xpointer(//*[@os='p2'])"/>
 
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
Index: patches/tar-1.21-revert_pipe_drain-1.patch
===================================================================
--- patches/tar-1.21-revert_pipe_drain-1.patch	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
+++ patches/tar-1.21-revert_pipe_drain-1.patch	(revision bf56c2549036a42bbe1f5e746daa403cd7bc90ec)
@@ -0,0 +1,109 @@
+Submitted By: Jim Gifford (jim at cross-lfs dot org)
+Date: 2009-01-04
+Initial Package Version: 1.21
+Origin: Tar Bug List
+Upstream Status: Applied
+Description: http://lists.gnu.org/archive/html/bug-tar/2008-12/msg00028.html
+
+diff -Naur tar-1.21.orig/src/buffer.c tar-1.21/src/buffer.c
+--- tar-1.21.orig/src/buffer.c	2008-11-30 04:30:29.000000000 -0800
++++ tar-1.21/src/buffer.c	2009-01-04 20:04:57.000000000 -0800
+@@ -848,6 +848,8 @@
+         flush_archive ();
+     }
+ 
++  sys_drain_input_pipe ();
++
+   compute_duration ();
+   if (verify_option)
+     verify_volume ();
+@@ -855,7 +857,7 @@
+   if (rmtclose (archive) != 0)
+     close_error (*archive_name_cursor);
+ 
+-  sys_wait_for_child (child_pid, hit_eof);
++  sys_wait_for_child (child_pid);
+ 
+   tar_stat_destroy (&current_stat_info);
+   if (save_name)
+diff -Naur tar-1.21.orig/src/common.h tar-1.21/src/common.h
+--- tar-1.21.orig/src/common.h	2008-11-30 04:30:29.000000000 -0800
++++ tar-1.21/src/common.h	2009-01-04 20:04:57.000000000 -0800
+@@ -699,7 +699,8 @@
+ 
+ void sys_detect_dev_null_output (void);
+ void sys_save_archive_dev_ino (void);
+-void sys_wait_for_child (pid_t, bool);
++void sys_drain_input_pipe (void);
++void sys_wait_for_child (pid_t);
+ void sys_spawn_shell (void);
+ bool sys_compare_uid (struct stat *a, struct stat *b);
+ bool sys_compare_gid (struct stat *a, struct stat *b);
+diff -Naur tar-1.21.orig/src/system.c tar-1.21/src/system.c
+--- tar-1.21.orig/src/system.c	2008-11-30 04:30:30.000000000 -0800
++++ tar-1.21/src/system.c	2009-01-04 20:04:57.000000000 -0800
+@@ -1,7 +1,6 @@
+ /* System-dependent calls for tar.
+ 
+-   Copyright (C) 2003, 2004, 2005, 2006, 2007,
+-   2008 Free Software Foundation, Inc.
++   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 
+    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 the
+@@ -52,7 +51,12 @@
+ }
+ 
+ void
+-sys_wait_for_child (pid_t child_pid, bool eof)
++sys_drain_input_pipe (void)
++{
++}
++
++void
++sys_wait_for_child (pid_t child_pid)
+ {
+ }
+ 
+@@ -156,8 +160,26 @@
+ 			 && archive_stat.st_ino == dev_null_stat.st_ino));
+ }
+ 
++/* Manage to fully drain a pipe we might be reading, so to not break it on
++   the producer after the EOF block.  FIXME: one of these days, GNU tar
++   might become clever enough to just stop working, once there is no more
++   work to do, we might have to revise this area in such time.  */
++
++void
++sys_drain_input_pipe (void)
++{
++  size_t r;
++
++  if (access_mode == ACCESS_READ
++      && ! _isrmt (archive)
++      && (S_ISFIFO (archive_stat.st_mode) || S_ISSOCK (archive_stat.st_mode)))
++    while ((r = rmtread (archive, record_start->buffer, record_size)) != 0
++	   && r != SAFE_READ_ERROR)
++      continue;
++}
++
+ void
+-sys_wait_for_child (pid_t child_pid, bool eof)
++sys_wait_for_child (pid_t child_pid)
+ {
+   if (child_pid)
+     {
+@@ -171,11 +193,8 @@
+ 	  }
+ 
+       if (WIFSIGNALED (wait_status))
+-	{
+-	  int sig = WTERMSIG (wait_status);
+-	  if (!(!eof && sig == SIGPIPE))
+-	    ERROR ((0, 0, _("Child died with signal %d"), sig));
+-	}
++	ERROR ((0, 0, _("Child died with signal %d"),
++		WTERMSIG (wait_status)));
+       else if (WEXITSTATUS (wait_status) != 0)
+ 	ERROR ((0, 0, _("Child returned status %d"),
+ 		WEXITSTATUS (wait_status)));
