[PATCH] "lone zero block" warning due to non-POSIX compliant Tar implementation
| From: | Andreas Korthaus | Date: | Tue, 08 Nov 2005 17:06:07 +0000 |
| Subject: | [PATCH] "lone zero block" warning due to non-POSIX compliant Tar implementation | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-40401@lists.php.net to get a copy of this message | ||
Hi!
I posted this patch 2 month ago, but accidently for an old version of
PEAR::Archive_Tar. I attatched a new patch against the latest CVS version.
The current version of Archive_Tar writes only ONE zero block to mark
the end of an archive, but POSIX.1 and some GNU Tar implementations
require TWO zero blocks as GNU-Tar specification describes.
e.g. every Gentoo Linux user gets this warning whenever he installs a
PEAR/PECL package. The fix is quite simple, and I've tested it with some
archives. The idea for the solution comes from Ant, which has been fixed
some months ago.
I also created a PEAR bug for this issue, but without response yet:
http://pear.php.net/bugs/bug.php?id=5452
Would be great if this patch could make it into the next
PEAR::Archive_Tar release.
best regards
Andreas
Andreas Korthaus wrote:
> Hi!
>
> When extracting .tgz files created with PEAR::Archive_Tar (e.g. PECL and
> PEAR packages), newer GNU tar implementations show a warning like:
>
> 'tar: A lone zero block at *'
>
> The reason for this message is that GNU tar format has been changed to
> require TWO zero blocks marking the end of the archive but
> PEAR::Archive_Tar is writing only ONE zero block.
>
> Details:
> http://www.gnu.org/software/tar/manual/html_chapter/tar_8.html#SEC134g‹ACãÏaýh
> ¬J¦=
>
> I found the solution here (fix for Ant):
> http://issues.apache.org/bugzilla/show_bug.cgi?id=28776
>
> The solution should be quite simple:
>
> Index: Tar.php
> ===================================================================
> RCS file: /repository/pear-core/Archive/Tar.php,v
> retrieving revision 1.20
> diff -u -p -r1.20 Tar.php
> --- Tar.php 8 Jan 2004 17:33:09 -0000 1.20
> +++ Tar.php 19 Sep 2005 12:40:15 -0000
> @@ -719,6 +719,7 @@ class Archive_Tar extends PEAR
> // ----- Write the last 0 filled block for end of archive
> $v_binary_data = pack("a512", '');
> $this->_writeBlock($v_binary_data);
> + $this->_writeBlock($v_binary_data);
> }
> return true;
> }
> cvs diff: Diffing docs
>
> Should not be a problem with BC, as a zero block is used to finish an
> archive.
>
> this will fix:
> -> http://pear.php.net/bugs/bug.php?id=3694
> -> http://pear.php.net/bugs/bug.php?id=5452
>
>
> best regards
> Andreas