Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access phar file entry '/' in archive 'myfile.tgz' #12

Open
BigNerd opened this issue Jan 11, 2019 · 4 comments
Open

Cannot access phar file entry '/' in archive 'myfile.tgz' #12

BigNerd opened this issue Jan 11, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@BigNerd
Copy link

BigNerd commented Jan 11, 2019

Describe the bug

When trying to extract a .tgz file with UnifiedArchive it reports the following error message:
In Tar.php line 369:
"Cannot access phar file entry '/' in archive 'myfile.tgz'"

Doing the same with CLI commands gunzip myfile.tgz & tar xf myfile.tar works fine.

Configuration

  • OS: linux debian 9.3
  • Version of library: 0.1.2
  • Satisfied Composer dependencies (selection)
    "php": "^7.0",
    "ext-phar": "",
    "ext-zip": "
    ",
    "ext-zlib": "*",
    "pear/archive_tar": "~1.4.3",
    "wapmorgan/unified-archive": "^0.1"

tar -tvf myfile.tar shows this (shortened list):
drwxr-xr-x web/users 0 2019-01-11 02:10 ./
-rw-r--r-- web/users 15254 2019-01-11 02:10 ./myfile.xml

To Reproduce

$archive = UnifiedArchive::open($absoluteArchiveFilePath);
$numberOfFiles = $archive->extractFiles($absoluteTargetDirPath);

Expected behavior

Contents of .tgz file should be extracted to the target directory.

@wapmorgan wapmorgan self-assigned this Jan 11, 2019
@wapmorgan
Copy link
Owner

Can you attach this archive?

@BigNerd
Copy link
Author

BigNerd commented Jan 14, 2019

UnifiedArchive seems to have trouble with the entry ./ in the tar file. The file myfile.tgz which causes the error message when trying to extract it can be created as follows:
tmp# ls
myfile.xml

tmp# tar -cvf myfile.tar .
./
tar: ./myfile.tar: file is the archive; not dumped
./myfile.xml

tmp# tar -tvf myfile.tar
./
./myfile.xml

tmp# gzip myfile.tar
tmp# mv myfile.tar.gz myfile.tgz

Please find attached a file that was created in this way.
As GitHub does not support that file type, I had to zip it in addition.
myfile.tgz.zip

@wapmorgan
Copy link
Owner

Ok, will see in few hours.

@wapmorgan
Copy link
Owner

This is phar extension related problem: https://bugs.php.net/bug.php?id=71966
Reported this case, will wait for response.

@wapmorgan wapmorgan added this to the 0.1.3 milestone Jan 16, 2019
@wapmorgan wapmorgan added the bug label May 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants