UnifiedArchive icon indicating copy to clipboard operation
UnifiedArchive copied to clipboard

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

Open BigNerd opened this issue 6 years ago • 4 comments

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.

BigNerd avatar Jan 11 '19 19:01 BigNerd

Can you attach this archive?

wapmorgan avatar Jan 13 '19 17:01 wapmorgan

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

BigNerd avatar Jan 14 '19 10:01 BigNerd

Ok, will see in few hours.

wapmorgan avatar Jan 14 '19 15:01 wapmorgan

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

wapmorgan avatar Jan 16 '19 13:01 wapmorgan