git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Peter Krefting <peter@softwolves.pp.se>,
	Johannes Sixt <j6t@kdbg.org>
Subject: Re: What's cooking in git.git (Apr 2017, #06; Wed, 26)
Date: Thu, 27 Apr 2017 22:25:45 +0200	[thread overview]
Message-ID: <a7545d98-7203-7bd6-faa2-9bb1e718539a@web.de> (raw)
In-Reply-To: <xmqqfugupnk3.fsf@gitster.mtv.corp.google.com>

Am 27.04.2017 um 04:54 schrieb Junio C Hamano:
> * rs/large-zip (2017-04-24) 5 commits
>    (merged to 'next' on 2017-04-26 at a6beab60f2)
>   + archive-zip: support files bigger than 4GB
>   + archive-zip: support archives bigger than 4GB
>   + archive-zip: write ZIP dir entry directly to strbuf
>   + archive-zip: use strbuf for ZIP directory
>   + archive-zip: add tests for big ZIP archives
> 
>   "git archive --format=zip" learned to use zip64 extension when
>   necessary to go beyond the 4GB limit.
> 
>   Will merge to 'master'.

Woah, that was quick.  We need this fix on top:

-- >8 --
Subject: [PATCH] archive-zip: set version field for big files correctly

Signal that extractors need to implement spec version 4.5 (or higher)
for files with sizes of 4GB and more.  Older unzippers might produce
truncated results otherwise; they should rather refuse to extract.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 archive-zip.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/archive-zip.c b/archive-zip.c
index 44ed78f163..e81c5ac15a 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -298,6 +298,7 @@ static int write_zip_entry(struct archiver_args *args,
 	int is_binary = -1;
 	const char *path_without_prefix = path + args->baselen;
 	unsigned int creator_version = 0;
+	unsigned int version_needed = 10;
 	size_t zip_dir_extra_size = ZIP_EXTRA_MTIME_SIZE;
 	size_t zip64_dir_extra_payload_size = 0;
 
@@ -382,8 +383,11 @@ static int write_zip_entry(struct archiver_args *args,
 	if (stream && size > 0x7fffffff)
 		need_zip64_extra = 1;
 
+	if (need_zip64_extra)
+		version_needed = 45;
+
 	copy_le32(header.magic, 0x04034b50);
-	copy_le16(header.version, 10);
+	copy_le16(header.version, version_needed);
 	copy_le16(header.flags, flags);
 	copy_le16(header.compression_method, method);
 	copy_le16(header.mtime, zip_time);
@@ -509,7 +513,7 @@ static int write_zip_entry(struct archiver_args *args,
 
 	strbuf_add_le(&zip_dir, 4, 0x02014b50);	/* magic */
 	strbuf_add_le(&zip_dir, 2, creator_version);
-	strbuf_add_le(&zip_dir, 2, 10);		/* version */
+	strbuf_add_le(&zip_dir, 2, version_needed);
 	strbuf_add_le(&zip_dir, 2, flags);
 	strbuf_add_le(&zip_dir, 2, method);
 	strbuf_add_le(&zip_dir, 2, zip_time);
-- 
2.12.2


      reply	other threads:[~2017-04-27 20:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27  2:54 What's cooking in git.git (Apr 2017, #06; Wed, 26) Junio C Hamano
2017-04-27 20:25 ` René Scharfe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a7545d98-7203-7bd6-faa2-9bb1e718539a@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=peter@softwolves.pp.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).