Bug #77229 [Opn]: Phar::buildFromDirectory() generates tar archives in 'PAX' format
| From: | michae dot lee at zerustech dot com | Date: | Mon, 03 Dec 2018 03:46:38 +0000 |
| Subject: | Bug #77229 [Opn]: Phar::buildFromDirectory() generates tar archives in 'PAX' format | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218249@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77229&edit=1
ID: 77229
User updated by: michae dot lee at zerustech dot com
Reported by: michae dot lee at zerustech dot com
Summary: Phar::buildFromDirectory() generates tar archives in
'PAX' format
Status: Open
Type: Bug
Package: PHAR related
Operating System: macOS High Sierra 10.13.6
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
PHP version is 7.2.4
Previous Comments:
------------------------------------------------------------------------
[2018-12-03 02:54:23] michae dot lee at zerustech dot com
Description:
------------
The
Phar::buildFromDirectory() method generates tar archives in PAX
format, so different tar archives that contain the same files may have different sha1
checksums.
Test script:
---------------
<?php
// mkdir test && echo 'hello' > test/test.txt
$phar = new \PharData('a.tar');
$phar->buildFromDirectory('test');
// sleep for 1 second to produce different atime.
sleep(1);
$phar = new \PharData('b.tar');
$phar->buildFromDirectory('test');
echo sha1_file('a.tar') . "\n";
echo sha1_file('b.tar') . "\n";
// a.tar and b.tar contain the same files, but have different checksums
// Looks like the buildFromDirectory() method generates tar archives
// with PAX headers. Calling "tar --format=ustar -cf ..." from command line
// resolves this issue.
Expected result:
----------------
The sha1 checksums for a.tar and b.tar should be the same.
Actual result:
--------------
The sha1 checksums for a.tar and b.tar are different.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77229&edit=1