From: "Shawn O. Pearce" <spearce@spearce•org>
To: Junio C Hamano <junkio@cox•net>
Cc: git@vger•kernel.org
Subject: [PATCH] Don't die in git-http-fetch when fetching packs.
Date: Tue, 9 Jan 2007 20:04:52 -0500 [thread overview]
Message-ID: <20070110010452.GA30610@spearce.org> (raw)
My sp/mmap changes to pack-check.c modified the function such that
it expects packed_git.pack_size to be populated with the total
bytecount of the packfile by the caller.
But that isn't the case for packs obtained by git-http-fetch as
pack_size was not initialized before being accessed. This caused
verify_pack to think it had 2^32-21 bytes available when the
downloaded pack perhaps was only 305 bytes in length. The use_pack
function then later dies with "offset beyond end of packfile"
when computing the overall file checksum.
Signed-off-by: Shawn O. Pearce <spearce@spearce•org>
---
For the tip of my sp/mmap topic. Without it HTTP fetch and push
support is severely broken as it cannot deal with packs.
http-fetch.c | 1 +
http-push.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/http-fetch.c b/http-fetch.c
index fe8cd7b..67dfb0a 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -809,6 +809,7 @@ static int fetch_pack(struct alt_base *repo, unsigned char *sha1)
return error("Unable to start request");
}
+ target->pack_size = ftell(packfile);
fclose(packfile);
ret = move_temp_to_file(tmpfile, filename);
diff --git a/http-push.c b/http-push.c
index 7e73eac..8eb448e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -770,6 +770,7 @@ static void finish_request(struct transfer_request *request)
request->url, curl_errorstr);
remote->can_update_info_refs = 0;
} else {
+ target->pack_size = ftell(request->local_stream);
fclose(request->local_stream);
request->local_stream = NULL;
if (!move_temp_to_file(request->tmpfile,
--
1.4.4.4.gf198
next reply other threads:[~2007-01-10 1:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-10 1:04 Shawn O. Pearce [this message]
2007-01-10 1:10 ` [PATCH] Don't die in git-http-fetch when fetching packs Junio C Hamano
2007-01-10 1:28 ` Shawn O. Pearce
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070110010452.GA30610@spearce.org \
--to=spearce@spearce$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=junkio@cox$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox