Bug #19330 [Opn]: Class creates incorrect (non-readable) tar.gz file
| From: | daniel dot oconnor at gmail dot com | Date: | Sat, 31 Mar 2012 17:17:14 +0000 |
| Subject: | Bug #19330 [Opn]: Class creates incorrect (non-readable) tar.gz file | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8478@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19330&edit=1
ID: 19330
Updated by: daniel.oconnor@gmail.com
Reported By: schmale at froglogic dot com
Summary: Class creates incorrect (non-readable) tar.gz file
Status: Open
Type: Bug
Package: Archive_Tar
Operating System: Ubuntu
Package Version: 1.3.9
PHP Version: 5.3.6
Roadmap Versions:
New Comment:
Perhaps post as a gist?
Previous Comments:
------------------------------------------------------------------------
[2012-03-12 11:38:13] schmale
I'm unable to attach the problematic file. The file is a png image of
about 17K size. Please tell me where to mail (or
send) the file.
------------------------------------------------------------------------
[2012-03-12 11:31:00] schmale
Description:
------------
Under specific circumstances, the class produces an invalid tar.gz
file:
1) A specific file has to be included (see attachment). I tried other
files, but
only with this file did the error occur.
2) The file must NOT be the only file in its directory
3) A second directory has to be added (directory can be empty).
Important
is, that the second directory is added via a separate add/addModify
call, the
two directories must NOT be added in a single add/addModify call (via
file
list). Also, it is important that the second directory is added AFTER
the first
directory.
So, to reproduce the error, create a (new) directory, copy the attached
file
into it, and create/copy another file (I created a file named a.txt,
containing
'abc' - note that the second file must not be empty, as it is not added
otherwise) in/to it.
Adapt the test script to add this directory first, and then an arbitrary
other
directory (you may create an empty directory to keep things simple).
Then run the script and try to open the resulting tar.gz file - it
should be
broken.
The problem did only occur when using gzip (or bzip2). Creating a plain
tar
file and using gzencode or gzopen/gzputs separately on it does work
correctly.
Test script:
---------------
<?php
$compressor = new Archive_Tar('/tmp/debug.tar.gz', 'gz');
$compressor->add('testdebug');
$compressor->add('testdebug2');
?>
Expected result:
----------------
A valid .tar.gz file.
Actual result:
--------------
An invalid tar.gz file.
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19330&edit=1