Bug #77229 [NEW]: Phar::buildFromDirectory() generates tar archives in 'PAX' format
| From: | michae dot lee at zerustech dot com | Date: | Mon, 03 Dec 2018 02:54:23 +0000 |
| Subject: | Bug #77229 [NEW]: Phar::buildFromDirectory() generates tar archives in 'PAX' format | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-218248@lists.php.net to get a copy of this message | ||
From: michae dot lee at zerustech dot com
Operating system: macOS High Sierra 10.13.6
PHP version: Irrelevant
Package: PHAR related
Bug Type: Bug
Bug description:Phar::buildFromDirectory() generates tar archives in 'PAX' format
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 bug report at https://bugs.php.net/bug.php?id=77229&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77229&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77229&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77229&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77229&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77229&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77229&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77229&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77229&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77229&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77229&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77229&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77229&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77229&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77229&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77229&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77229&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77229&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77229&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77229&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77229&r=mysqlcfg