You are viewing a plain text version of this content. The canonical link for it is here.
Posted to zeta-commits@incubator.apache.org by de...@apache.org on 2010/09/02 11:16:13 UTC
[zeta-commits] svn commit: r991891 - in /incubator/zetacomponents/trunk/Archive: ChangeLog
src/tar/v7.php tests/data/tar_v7_truncated_block.tar
tests/tar/v7_tar_test.php
Author: derick
Date: Thu Sep 2 11:16:12 2010
New Revision: 991891
URL: http://svn.apache.org/viewvc?rev=991891&view=rev
Log:
- Fixed #ZETACOMP-8: Double extraction causes empty file. (Patch by Patrick
Alaert).
Added:
incubator/zetacomponents/trunk/Archive/tests/data/tar_v7_truncated_block.tar (with props)
Modified:
incubator/zetacomponents/trunk/Archive/ChangeLog
incubator/zetacomponents/trunk/Archive/src/tar/v7.php
incubator/zetacomponents/trunk/Archive/tests/tar/v7_tar_test.php
Modified: incubator/zetacomponents/trunk/Archive/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/trunk/Archive/ChangeLog?rev=991891&r1=991890&r2=991891&view=diff
==============================================================================
--- incubator/zetacomponents/trunk/Archive/ChangeLog (original)
+++ incubator/zetacomponents/trunk/Archive/ChangeLog Thu Sep 2 11:16:12 2010
@@ -1,3 +1,10 @@
+1.4.2 - [RELEASEDATE]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fixed #ZETACOMP-8: Double extraction causes empty file. (Patch by Patrick
+ Alaert).
+
+
1.4.1 - Monday 22 March 2010
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modified: incubator/zetacomponents/trunk/Archive/src/tar/v7.php
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/trunk/Archive/src/tar/v7.php?rev=991891&r1=991890&r2=991891&view=diff
==============================================================================
--- incubator/zetacomponents/trunk/Archive/src/tar/v7.php (original)
+++ incubator/zetacomponents/trunk/Archive/src/tar/v7.php Thu Sep 2 11:16:12 2010
@@ -206,7 +206,7 @@ class ezcArchiveV7Tar extends ezcArchive
$newBlock = $this->headerPositions[ $this->fileNumber - 1 ] + $this->file->getBlocksFromBytes( $this->headers[ $this->fileNumber - 1 ]->fileSize );
// Search for that block.
- if ( $newBlock != $this->file->key() )
+ if ( $newBlock !== $this->file->key() )
{
$this->file->seek( $newBlock );
}
@@ -250,7 +250,7 @@ class ezcArchiveV7Tar extends ezcArchive
$requestedBlock = $this->headerPositions[$this->fileNumber];
$currentBlock = $this->file->key();
- if ( $currentBlock != $requestedBlock )
+ if ( $currentBlock !== $requestedBlock )
{
$this->file->seek( $requestedBlock );
}
Added: incubator/zetacomponents/trunk/Archive/tests/data/tar_v7_truncated_block.tar
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/trunk/Archive/tests/data/tar_v7_truncated_block.tar?rev=991891&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/zetacomponents/trunk/Archive/tests/data/tar_v7_truncated_block.tar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/zetacomponents/trunk/Archive/tests/tar/v7_tar_test.php
URL: http://svn.apache.org/viewvc/incubator/zetacomponents/trunk/Archive/tests/tar/v7_tar_test.php?rev=991891&r1=991890&r2=991891&view=diff
==============================================================================
--- incubator/zetacomponents/trunk/Archive/tests/tar/v7_tar_test.php (original)
+++ incubator/zetacomponents/trunk/Archive/tests/tar/v7_tar_test.php Thu Sep 2 11:16:12 2010
@@ -1110,6 +1110,31 @@ class ezcArchiveV7TarTest extends ezcArc
unset( $bf );
}
+ /**
+ * Test for issue ZETACOMP-8: Double extraction causes empty file
+ *
+ * The failure happens only with some tarballs. The easiest way to create
+ * such failing one is to remove some of the nul characters which are
+ * appended to the file's content to continue the block.
+ */
+ public function testDoubleExtraction()
+ {
+ $archive = ezcArchive::open( dirname( dirname( __FILE__ ) ) . "/data/tar_v7_truncated_block.tar" );
+ $dir = $this->getTempDir();
+
+ foreach ( $archive as $entry )
+ {
+ if ( $entry->getPath() === "file1" )
+ {
+ $archive->extractCurrent( $dir );
+ // break intentionally omitted.
+ }
+ }
+
+ $archive->extract( $dir );
+ $this->assertEquals( 13, filesize( "$dir/file1" ) );
+ }
+
public static function suite()
{
return new PHPUnit_Framework_TestSuite( __CLASS__ );