php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80326 Phar does not decompress properly
Submitted: 2020-11-06 07:16 UTC Modified: 2020-11-06 11:18 UTC
From: corentin dot jacquemet at infomaniak dot com Assigned:
Status: Open Package: PHAR related
PHP Version: 7.4.12 OS: Debian10/Alpine
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: corentin dot jacquemet at infomaniak dot com
New email:
PHP Version: OS:

 

 [2020-11-06 07:16 UTC] corentin dot jacquemet at infomaniak dot com
Description:
------------
Wget the official mediawiki 1.35.0 from the official website, then try to uncompressed the archive using Phar.

The last archive of mediawiki-1.35.0 is not uncompressed correctly by Phar.
Reproduced on php 7.0.33, 7.1.33, 7.2.34, 7.3.24 and 7.4.12, on debian 10 and alpine (official php docker image)

The "widgets" file should be a directory, not a file.
If we use tar command, the archive is uncompressed correctly.
If we uncompressed using tar command, then compress it into a new archive, Phar is able to uncompressed correctly this new archive.


Test script:
---------------
<?php
// decompress from gz
$p = new PharData('mediawiki-1.35.0.tar.gz');
$p->decompress(); // creates xxx.tar

// unarchive from the tar
$phar = new PharData('mediawiki-1.35.0.tar');
$phar->extractTo('extracted_'.date('Y-m-d-H:i'));

Expected result:
----------------
$ ls -lah extracted_2020-11-06-06\:44/mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.editTemplatePage/widgets
total 28
drwxr-xr-x    2 root     root        4.0K Nov  6 06:48 .
drwxr-xr-x    3 root     root        4.0K Nov  6 06:48 ..
-rw-rw-r--    1 1000     1000        2.3K Sep 25 14:38 LanguageResultWidget.js
-rw-rw-r--    1 1000     1000        3.6K Sep 25 14:38 LanguageSearchWidget.js
-rw-rw-r--    1 1000     1000        1.2K Sep 25 14:38 ParamImportWidget.js
-rw-rw-r--    1 1000     1000        1.0K Sep 25 14:38 ParamSelectWidget.js
-rw-rw-r--    1 1000     1000        1.7K Sep 25 14:38 ParamWidget.js

$ ls -lhd extracted_2020-11-06-06\:44/mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.ed
itTemplatePage/widgets
drwxr-xr-x    2 root     root        4.0K Nov  6 06:48 mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.editTemplatePage/widgets

Actual result:
--------------
$ ls -lah extracted_2020-11-06-06\:44/mediawiki-1.35.0/extensions/TemplateData/modules/
ext.templateDataGenerator.editTemplatePage/widgets
-rw-rw-r--    1 root     root        1.7K Nov  6 06:44 extracted_2020-11-06-06:44/mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.editTemplatePage/widgets

$ ls -lhd extracted_2020-11-06-06\:44/mediawiki-1.35.0/extensions/TemplateData/modules/
ext.templateDataGenerator.editTemplatePage/widgets
-rw-rw-r--    1 root     root        1.7K Nov  6 06:44 extracted_2020-11-06-06:44/mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.editTemplatePage/widgets

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-06 11:18 UTC] requinix@php.net
WinRAR doesn't like that directory either. This might be an upstream problem.

Ubuntu tar is happy, but I do see that widgets/ didn't seem to be bundled with timestamp data. And in your output, the subdirectory files are owned by UID 1000 instead of root.
 [2020-11-06 13:46 UTC] corentin dot jacquemet at infomaniak dot com
using find command, all files are owned by 1000, but all directories are owned by root. Seems the same for timestamp data
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jan 19 15:01:23 2021 UTC