Return-Path:
X-Original-To: apmail-commons-commits-archive@minotaur.apache.org
Delivered-To: apmail-commons-commits-archive@minotaur.apache.org
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by minotaur.apache.org (Postfix) with SMTP id D2BB19516
for ;
Sat, 10 Mar 2012 06:46:01 +0000 (UTC)
Received: (qmail 11154 invoked by uid 500); 10 Mar 2012 06:46:01 -0000
Delivered-To: apmail-commons-commits-archive@commons.apache.org
Received: (qmail 11032 invoked by uid 500); 10 Mar 2012 06:46:00 -0000
Mailing-List: contact commits-help@commons.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: dev@commons.apache.org
Delivered-To: mailing list commits@commons.apache.org
Received: (qmail 11005 invoked by uid 99); 10 Mar 2012 06:45:59 -0000
Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136)
by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Mar 2012 06:45:59 +0000
X-ASF-Spam-Status: No, hits=-2000.0 required=5.0
tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4)
by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Mar 2012 06:45:57 +0000
Received: from eris.apache.org (localhost [127.0.0.1])
by eris.apache.org (Postfix) with ESMTP id 33C0E238897A
for ; Sat, 10 Mar 2012 06:45:37 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r1299151 - in /commons/proper/compress/trunk/src:
changes/
main/java/org/apache/commons/compress/archivers/tar/ site/xdoc/
test/java/org/apache/commons/compress/archivers/tar/
Date: Sat, 10 Mar 2012 06:45:36 -0000
To: commits@commons.apache.org
From: bodewig@apache.org
X-Mailer: svnmailer-1.0.8-patched
Message-Id: <20120310064537.33C0E238897A@eris.apache.org>
X-Virus-Checked: Checked by ClamAV on apache.org
Author: bodewig
Date: Sat Mar 10 06:45:36 2012
New Revision: 1299151
URL: http://svn.apache.org/viewvc?rev=1299151&view=rev
Log:
rename bigFileMode to bigNumberMode. COMPRESS-182
Modified:
commons/proper/compress/trunk/src/changes/changes.xml
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
commons/proper/compress/trunk/src/site/xdoc/tar.xml
commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
Modified: commons/proper/compress/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1299151&r1=1299150&r2=1299151&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Sat Mar 10 06:45:36 2012
@@ -46,6 +46,11 @@ The type attribute can be add,u
+
+ The tar package can now write archives that use star/GNU/BSD
+ extensions or use the POSIX/PAX variant to store numeric
+ values that don't fit into the traditional header fields.
+
Added a workaround for a Bug some tar implementations that add
a NUL byte as first byte in numeric header fields.
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java?rev=1299151&r1=1299150&r2=1299151&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java Sat Mar 10 06:45:36 2012
@@ -48,14 +48,14 @@ public class TarArchiveOutputStream exte
/** POSIX/PAX extensions are used to store long file names in the archive. */
public static final int LONGFILE_POSIX = 3;
- /** Fail if a big file (> 8GiB) is required in the archive. */
- public static final int BIGFILE_ERROR = 0;
+ /** Fail if a big number (e.g. size > 8GiB) is required in the archive. */
+ public static final int BIGNUMBER_ERROR = 0;
- /** star/GNU tar/BSD tar extensions are used to store big file sizes in the archive. */
- public static final int BIGFILE_STAR = 1;
+ /** star/GNU tar/BSD tar extensions are used to store big number in the archive. */
+ public static final int BIGNUMBER_STAR = 1;
- /** POSIX/PAX extensions are used to store big file sizes in the archive. */
- public static final int BIGFILE_POSIX = 2;
+ /** POSIX/PAX extensions are used to store big numbers in the archive. */
+ public static final int BIGNUMBER_POSIX = 2;
private long currSize;
private String currName;
@@ -65,7 +65,7 @@ public class TarArchiveOutputStream exte
private final byte[] assemBuf;
protected final TarBuffer buffer;
private int longFileMode = LONGFILE_ERROR;
- private int bigFileMode = BIGFILE_ERROR;
+ private int bigNumberMode = BIGNUMBER_ERROR;
private boolean closed = false;
@@ -121,15 +121,15 @@ public class TarArchiveOutputStream exte
}
/**
- * Set the big file mode.
- * This can be BIGFILE_ERROR(0), BIGFILE_POSIX(1) or BIGFILE_STAR(2).
- * This specifies the treatment of big files (sizes > TarConstants.MAXSIZE).
- * Default is BIGFILE_ERROR.
- * @param bigFileMode the mode to use
+ * Set the big number mode.
+ * This can be BIGNUMBER_ERROR(0), BIGNUMBER_POSIX(1) or BIGNUMBER_STAR(2).
+ * This specifies the treatment of big files (sizes > TarConstants.MAXSIZE) and other numeric values to big to fit into a traditional tar header.
+ * Default is BIGNUMBER_ERROR.
+ * @param bigNumberMode the mode to use
* @since Apache Commons Compress 1.4
*/
- public void setBigFileMode(int bigFileMode) {
- this.bigFileMode = bigFileMode;
+ public void setBigNumberMode(int bigNumberMode) {
+ this.bigNumberMode = bigNumberMode;
}
@@ -237,9 +237,9 @@ public class TarArchiveOutputStream exte
}
}
- if (bigFileMode == BIGFILE_POSIX) {
+ if (bigNumberMode == BIGNUMBER_POSIX) {
addPaxHeadersForBigNumbers(paxHeaders, entry);
- } else if (bigFileMode != BIGFILE_STAR) {
+ } else if (bigNumberMode != BIGNUMBER_STAR) {
failForBigNumbers(entry);
}
@@ -247,7 +247,7 @@ public class TarArchiveOutputStream exte
writePaxHeaders(entry.getName(), paxHeaders);
}
- entry.writeEntryHeader(recordBuf, bigFileMode == BIGFILE_STAR);
+ entry.writeEntryHeader(recordBuf, bigNumberMode == BIGNUMBER_STAR);
buffer.writeRecord(recordBuf);
currBytes = 0;
@@ -458,7 +458,7 @@ public class TarArchiveOutputStream exte
TarConstants.MAXSIZE);
addPaxHeaderForBigNumber(paxHeaders, "uid", entry.getUserId(),
TarConstants.MAXID);
- // star extensions by J\u00f6rg Schillig
+ // star extensions by J\u00f6rg Schilling
addPaxHeaderForBigNumber(paxHeaders, "SCHILY.devmajor",
entry.getDevMajor(), TarConstants.MAXID);
addPaxHeaderForBigNumber(paxHeaders, "SCHILY.devminor",
Modified: commons/proper/compress/trunk/src/site/xdoc/tar.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/site/xdoc/tar.xml?rev=1299151&r1=1299150&r2=1299151&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/site/xdoc/tar.xml (original)
+++ commons/proper/compress/trunk/src/site/xdoc/tar.xml Sat Mar 10 06:45:36 2012
@@ -71,21 +71,23 @@
transparently.
-
+
- The bigFileMode
option of
+
The bigNumberMode
option of
TarArchiveOutputStream
controls how files larger
- than 8GiB are handled. The possible choices are:
+ than 8GiB or with other big numeric values that can't be
+ encoded in traditional header fields are handled. The
+ possible choices are:
- BIGFILE_ERROR
: throw an exception if such a
- file is added. This is the default.
- BIGFILE_STAR
: use a variant first
+ BIGNUMBER_ERROR
: throw an exception if such an
+ entry is added. This is the default.
+ BIGNUMBER_STAR
: use a variant first
introduced by Jörg Schilling's star
and later adopted by GNU and BSD tar. This method is not
supported by all implementations.
- BIGFILE_POSIX
: use a PAX BIGNUMBER_POSIX
: use a PAX extended
header as defined by POSIX 1003.1. Most modern tar
implementations are able to extract such archives.
@@ -93,8 +95,8 @@
Starting with Commons Compress 1.4
TarArchiveInputStream
will recognize the star as
- well as the POSIX extensions for big file sizes and reads the
- sizes transparently.
+ well as the POSIX extensions for big numeric values and reads them
+ transparently.
Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java?rev=1299151&r1=1299150&r2=1299151&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java (original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java Sat Mar 10 06:45:36 2012
@@ -76,12 +76,12 @@ public class TarArchiveOutputStreamTest
}
}
- public void testBigFileStarMode() throws Exception {
+ public void testBigNumberStarMode() throws Exception {
TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(0100000000000L);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
- tos.setBigFileMode(TarArchiveOutputStream.BIGFILE_STAR);
+ tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
tos.putArchiveEntry(t);
// make sure header is written to byte array
tos.write(new byte[10 * 1024]);
@@ -98,12 +98,12 @@ public class TarArchiveOutputStreamTest
assertEquals(0100000000000L, e.getSize());
}
- public void testBigFilePosixMode() throws Exception {
+ public void testBigNumberPosixMode() throws Exception {
TarArchiveEntry t = new TarArchiveEntry("foo");
t.setSize(0100000000000L);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
- tos.setBigFileMode(TarArchiveOutputStream.BIGFILE_POSIX);
+ tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
tos.putArchiveEntry(t);
// make sure header is written to byte array
tos.write(new byte[10 * 1024]);
@@ -213,7 +213,7 @@ public class TarArchiveOutputStreamTest
t.setModTime(-1000);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
- tos.setBigFileMode(TarArchiveOutputStream.BIGFILE_STAR);
+ tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
tos.putArchiveEntry(t);
// make sure header is written to byte array
tos.write(new byte[10 * 1024]);
@@ -239,7 +239,7 @@ public class TarArchiveOutputStreamTest
t.setModTime(-1000);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
- tos.setBigFileMode(TarArchiveOutputStream.BIGFILE_POSIX);
+ tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
tos.putArchiveEntry(t);
// make sure header is written to byte array
tos.write(new byte[10 * 1024]);