Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F14EE200C76 for ; Sat, 13 May 2017 23:53:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EFF66160BBB; Sat, 13 May 2017 21:53:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 42256160BB2 for ; Sat, 13 May 2017 23:53:10 +0200 (CEST) Received: (qmail 18173 invoked by uid 500); 13 May 2017 21:53:09 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 18162 invoked by uid 99); 13 May 2017 21:53:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 May 2017 21:53:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E1EB31A0240 for ; Sat, 13 May 2017 21:53:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id f1JGGST_0RJV for ; Sat, 13 May 2017 21:53:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4D51A5F567 for ; Sat, 13 May 2017 21:53:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7B275E002A for ; Sat, 13 May 2017 21:53:05 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id D0E0321E09 for ; Sat, 13 May 2017 21:53:04 +0000 (UTC) Date: Sat, 13 May 2017 21:53:04 +0000 (UTC) From: "Plamen Totev (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (COMPRESS-394) Zip - Local `Version Needed To Extract` does not match Central Directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 13 May 2017 21:53:11 -0000 Plamen Totev created COMPRESS-394: ------------------------------------- Summary: Zip - Local `Version Needed To Extract` does not match Central Directory Key: COMPRESS-394 URL: https://issues.apache.org/jira/browse/COMPRESS-394 Project: Commons Compress Issue Type: Bug Components: Archivers Reporter: Plamen Totev Hi, This is followup on an issue reported on Plexus Archiver - https://github.com/codehaus-plexus/plexus-archiver/issues/57 Plexus Archiver uses {{ZipArchiveOutputStream}} to create zip archives. It constructs the {{ZipArchiveOutputStream}} using {{BufferedOutputStream}}. As a result the output do not provide random access and additional data descriptor records are added. Unfortunately this leads to different values being set for {{version needed to extract}} field in the local file header and in the central directory. It looks like that the root cause is the way the local header {{version needed to extract}} field value is calculated: {code:java} if (phased && !isZip64Required(entry.entry, zip64Mode)){ putShort(INITIAL_VERSION, buf, LFH_VERSION_NEEDED_OFFSET); } else { putShort(versionNeededToExtract(zipMethod, hasZip64Extra(ze)), buf, LFH_VERSION_NEEDED_OFFSET); } {code} As you can see the need for data descriptors is not taken into account. On other hand when the central directory is created the following is used to determine the minimum required version {code:java} private int versionNeededToExtract(final int zipMethod, final boolean zip64) { if (zip64) { return ZIP64_MIN_VERSION; } // requires version 2 as we are going to store length info // in the data descriptor return (isDeflatedToOutputStream(zipMethod)) ? DATA_DESCRIPTOR_MIN_VERSION : INITIAL_VERSION; } {code} As a side note: I'm not a zip expert by any means so I could be wrong, but my understanding is that if Deflate compression is used then the minimum required version should be 2.0 regardless if data descriptors are used or not. -- This message was sent by Atlassian JIRA (v6.3.15#6346)