From adb11f5b72da9952fa2ad0bf0065239590ec6a47 Mon Sep 17 00:00:00 2001
From: Christoph Gysin <christoph.gysin@gmail.com>
Date: Fri, 31 May 2013 20:10:24 +0300
Subject: [PATCH 2/5] add unittest to expose bug with long symlinks

---
 .../apache/commons/compress/archivers/LongPathTest.java |  11 +++++++++++
 src/test/resources/longsymlink/files.txt                |   1 +
 src/test/resources/longsymlink/gnu.tar                  | Bin 0 -> 10240 bytes
 3 files changed, 12 insertions(+)
 create mode 100644 src/test/resources/longsymlink/files.txt
 create mode 100644 src/test/resources/longsymlink/gnu.tar

diff --git a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
index 983c215..90655e4 100644
--- a/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java
@@ -65,6 +65,7 @@ public class LongPathTest extends AbstractTestCase {
     public static TestSuite suite() throws IOException{
         TestSuite suite = new TestSuite("LongPathTests");
         suite.addTest(createSuite("LongPathTest", "longpath"));
+        suite.addTest(createSuite("LongSymlinkTest", "longsymlink"));
         return suite;
     }
 
@@ -100,6 +101,16 @@ public class LongPathTest extends AbstractTestCase {
         return suite;
     }
 
+    protected String getExpectedString(ArchiveEntry entry) {
+        if (entry instanceof TarArchiveEntry) {
+            TarArchiveEntry tarEntry = (TarArchiveEntry) entry;
+            if (tarEntry.isSymbolicLink()) {
+                return tarEntry.getName() + " -> " + tarEntry.getLinkName();
+            }
+        }
+        return entry.getName();
+    }
+
     public void testArchive() throws Exception {
         ArrayList<String> fileList = fileLists.get(name);
         @SuppressWarnings("unchecked") // fileList is of correct type
diff --git a/src/test/resources/longsymlink/files.txt b/src/test/resources/longsymlink/files.txt
new file mode 100644
index 0000000..2af0afd
--- /dev/null
+++ b/src/test/resources/longsymlink/files.txt
@@ -0,0 +1 @@
+0xxxxxxxxx10xxxxxxxx20xxxxxxxx30xxxxxxxx40xxxxxxxx50xxxxxxxx60xxxxxxxx70xxxxxxxx80xxxxxxxx90xxxxxxxx100xxxxxxx110xxxxxxx120xxxxxxx130xxxxxxx -> 0yyyyyyyyy10yyyyyyyy20yyyyyyyy30yyyyyyyy40yyyyyyyy50yyyyyyyy60yyyyyyyy70yyyyyyyy80yyyyyyyy90yyyyyyyy100yyyyyyy110yyyyyyy120yyyyyyy130yyyyyyy
diff --git a/src/test/resources/longsymlink/gnu.tar b/src/test/resources/longsymlink/gnu.tar
new file mode 100644
index 0000000000000000000000000000000000000000..b747f11ec5d52514642e0984c3cdd2c006f1ef01
GIT binary patch
literal 10240
zcmeH}L2AP=5Jhzqoxsu9mXz$euP;$bX+t3fI|1qTk!keHEZQzYOw)d0@RLV)%o~Pr
zvuQRD!+3Zd_J?<Ko8>;1`Qq+c@in#_F;2vX*4W3}e2#wWX+Azp)|zP?k2<1vKgIRw
zyV<#1mjGK(2kJo{6hINQ1?@oMDhiSak_eLAjkG`Xq0MjY|IXN94bT6*|5IJ!Dz%^v
z)Pp=IfFfuM+JQ>{UtV4MzY>y^{=Yn1quk7)4OI6jp)?7lNhnRarvA%Nk1;MYUZOAa
zeSyALGhfP2K)FgJ7#Ac)F%}~tXUvWK`4Dp>Uo)I)|3AM?`&qkDyVLwKeHT}UxuF3X
wpaB}70UDqI8lV9hpaB}70UDqI8lV9hpaB}70UDqI8lV9hpaB}7fpra>0o+Rde*gdg

literal 0
HcmV?d00001

-- 
1.8.3

