zip64 compatibility problems
Martin Buchholz
martinrb at google.com
Wed Jan 16 02:12:44 UTC 2013
You want code? I got code.
@@ -75,6 +75,18 @@
}
/**
+ * Whether to use ZIP64 for zip files with more than 64k entries.
+ * When ZIP64 support in zip implementations is ubiquitous, this
+ * should default to true, but before then, defaulting to false is
+ * more portable, since most zip implementations tolerate
+ * incorrect total entry count fields.
+ */
+ private static final boolean useZip64For64kEntries =
+ java.security.AccessController.doPrivileged(
+ new sun.security.action.GetBooleanAction(
+ "java.util.zip.useZip64For64kEntries")).booleanValue();
+
+ /**
* Checks to make sure that this stream has not been closed.
*/
private void ensureOpen() throws IOException {
@@ -534,8 +546,10 @@
}
int count = xentries.size();
if (count >= ZIP64_MAGICCOUNT) {
- count = ZIP64_MAGICCOUNT;
- hasZip64 = true;
+ hasZip64 |= useZip64For64kEntries;
+ if (hasZip64) {
+ count = ZIP64_MAGICCOUNT;
+ }
}
if (hasZip64) {
long off64 = written;
On Tue, Jan 15, 2013 at 5:33 PM, Martin Buchholz <martinrb at google.com> wrote:
> On Tue, Jan 15, 2013 at 5:23 PM, Xueming Shen <xueming.shen at oracle.com> wrote:
>> Hi Martin,
>>
>> I would assume you are not asking for a similar flag for jar to disable the
>> zip64 support (or even something at API level) to generate "old" style
>> jar/zip
>> file for > 64k entries, but the backport of this changeset to 7u, right?
>
> Actually, I think y'all should do 3 things:
> - backport Kumar's bug fix to jdk7
> - introduce a system property to turn off the zip64 support.
> I am working on a patch to introduce such a system property.
> We will probably default to disabling zip64 by default, but you will
> probably find that unacceptable. But you can default the other way.
> - fix up some remaining largefile issues in parse_manifest
> I might contribute a bit of code here as well.
More information about the core-libs-dev
mailing list