From 421a2704022cbc8fa07ab673c2d503199f460b8e Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 4 Nov 2012 10:36:58 +0100 Subject: Tar: Added extraction support for long file names Supports POSIX ustar prefixes and GNU longlink entries --- _test/tests/inc/tar.test.php | 17 ++++++++++++++++- _test/tests/inc/tar/longpath-gnu.tgz | Bin 0 -> 413 bytes _test/tests/inc/tar/longpath-ustar.tgz | Bin 0 -> 311 bytes 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 _test/tests/inc/tar/longpath-gnu.tgz create mode 100644 _test/tests/inc/tar/longpath-ustar.tgz (limited to '_test') diff --git a/_test/tests/inc/tar.test.php b/_test/tests/inc/tar.test.php index 4de9e668d..9abd27612 100644 --- a/_test/tests/inc/tar.test.php +++ b/_test/tests/inc/tar.test.php @@ -218,7 +218,6 @@ class Tar_TestCase extends DokuWikiTest { } } - /** * Check the extension to compression guesser */ @@ -234,4 +233,20 @@ class Tar_TestCase extends DokuWikiTest { $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tar.BZ2')); $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tar.bz2')); } + + public function test_longpathextract(){ + $dir = dirname(__FILE__).'/tar'; + $out = sys_get_temp_dir().'/dwtartest'.md5(time()); + + foreach(array('ustar','gnu') as $format){ + $tar = new Tar(); + $tar->open("$dir/longpath-$format.tgz"); + $tar->extract($out); + + $this->assertFileExists($out.'/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/test.txt'); + + TestUtils::rdelete($out); + } + } + } \ No newline at end of file diff --git a/_test/tests/inc/tar/longpath-gnu.tgz b/_test/tests/inc/tar/longpath-gnu.tgz new file mode 100644 index 000000000..6c937c8fe Binary files /dev/null and b/_test/tests/inc/tar/longpath-gnu.tgz differ diff --git a/_test/tests/inc/tar/longpath-ustar.tgz b/_test/tests/inc/tar/longpath-ustar.tgz new file mode 100644 index 000000000..59efbff66 Binary files /dev/null and b/_test/tests/inc/tar/longpath-ustar.tgz differ -- cgit v1.2.3