You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2016/05/20 16:44:19 UTC

[1/2] commons-compress git commit: COMPRESS-356 properly deal with PAX header entries ending in slash

Repository: commons-compress
Updated Branches:
  refs/heads/master 19a620c90 -> f7cf7ab61


COMPRESS-356 properly deal with PAX header entries ending in slash

Suggested-by: Jeremy Gustie <jeremy at gustie dot com>


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/823cdee9
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/823cdee9
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/823cdee9

Branch: refs/heads/master
Commit: 823cdee9b18508e9e51913d110a20a406f55582b
Parents: 19a620c
Author: Stefan Bodewig <bo...@apache.org>
Authored: Fri May 20 18:42:10 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri May 20 18:42:10 2016 +0200

----------------------------------------------------------------------
 src/changes/changes.xml                             |   5 +++++
 .../compress/archivers/tar/TarArchiveEntry.java     |   2 +-
 .../archivers/tar/TarArchiveInputStreamTest.java    |  15 +++++++++++++++
 src/test/resources/COMPRESS-356.tar                 | Bin 0 -> 8192 bytes
 4 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/823cdee9/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 276bb66..e5517b3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,6 +65,11 @@ The <action> type attribute can be add,update,fix,remove.
         TarArchiveInputStream failed to parse PAX headers that
         included blank lines.
       </action>
+      <action issue="COMPRESS-356" type="fix" date="2016-05-20"
+              due-to="Jeremy Gustie">
+        TarArchiveInputStream failed to parse PAX headers whose tar
+        entry name ended with a slash.
+      </action>
     </release>
     <release version="1.11" date="2016-04-06"
              description="Release 1.11">

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/823cdee9/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index 941bbbd..a5050bf 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -856,7 +856,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
             return true;
         }
 
-        if (getName().endsWith("/")) {
+        if (!isPaxHeader() && !isGlobalPaxHeader() && getName().endsWith("/")) {
             return true;
         }
 

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/823cdee9/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
index 015748b..161ee12 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
@@ -313,6 +313,21 @@ public class TarArchiveInputStreamTest {
         }
     }
 
+    /**
+     * @link "https://issues.apache.org/jira/browse/COMPRESS-356"
+     */
+    @Test
+    public void survivesPaxHeaderWithNameEndingInSlash() throws Exception {
+        final TarArchiveInputStream is = getTestStream("/COMPRESS-356.tar");
+        try {
+            final TarArchiveEntry entry = is.getNextTarEntry();
+            assertEquals("package/package.json", entry.getName());
+            assertNull(is.getNextTarEntry());
+        } finally {
+            is.close();
+        }
+    }
+
     private TarArchiveInputStream getTestStream(final String name) {
         return new TarArchiveInputStream(
                 TarArchiveInputStreamTest.class.getResourceAsStream(name));

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/823cdee9/src/test/resources/COMPRESS-356.tar
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-356.tar b/src/test/resources/COMPRESS-356.tar
new file mode 100644
index 0000000..4dd6be9
Binary files /dev/null and b/src/test/resources/COMPRESS-356.tar differ


[2/2] commons-compress git commit: whitespace

Posted by bo...@apache.org.
whitespace


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/f7cf7ab6
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/f7cf7ab6
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/f7cf7ab6

Branch: refs/heads/master
Commit: f7cf7ab61242d464ddc6d055ec01359a31b5d86b
Parents: 823cdee
Author: Stefan Bodewig <bo...@apache.org>
Authored: Fri May 20 18:43:54 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri May 20 18:43:54 2016 +0200

----------------------------------------------------------------------
 .../apache/commons/compress/archivers/tar/TarArchiveEntry.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/f7cf7ab6/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index a5050bf..c0aed86 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -825,7 +825,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
      * @since 1.1
      *
      */
-    public boolean isPaxHeader(){
+    public boolean isPaxHeader() {
         return linkFlag == LF_PAX_EXTENDED_HEADER_LC
             || linkFlag == LF_PAX_EXTENDED_HEADER_UC;
     }
@@ -837,7 +837,7 @@ public class TarArchiveEntry implements TarConstants, ArchiveEntry {
      *
      * @since 1.1
      */
-    public boolean isGlobalPaxHeader(){
+    public boolean isGlobalPaxHeader() {
         return linkFlag == LF_PAX_GLOBAL_EXTENDED_HEADER;
     }