summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-04 10:36:58 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-11-04 10:36:58 +0100
commit421a2704022cbc8fa07ab673c2d503199f460b8e (patch)
tree8e4b9a5050b7d1b94aa24a0c969c72cd4cee8e74 /_test
parentfba11f64c26a8dde5f64c57233b0da84fae35959 (diff)
downloadrpg-421a2704022cbc8fa07ab673c2d503199f460b8e.tar.gz
rpg-421a2704022cbc8fa07ab673c2d503199f460b8e.tar.bz2
Tar: Added extraction support for long file names
Supports POSIX ustar prefixes and GNU longlink entries
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/tar.test.php17
-rw-r--r--_test/tests/inc/tar/longpath-gnu.tgzbin0 -> 413 bytes
-rw-r--r--_test/tests/inc/tar/longpath-ustar.tgzbin0 -> 311 bytes
3 files changed, 16 insertions, 1 deletions
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
--- /dev/null
+++ b/_test/tests/inc/tar/longpath-gnu.tgz
Binary files 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
--- /dev/null
+++ b/_test/tests/inc/tar/longpath-ustar.tgz
Binary files differ