From: Linus Torvalds <torvalds@osdl.org>
To: Alex Riesen <raa.lkml@gmail.com>, Junio C Hamano <junkio@cox.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: bug: git-repack -a -d produces broken pack on NFS
Date: Thu, 27 Apr 2006 15:11:13 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0604271500500.3701@g5.osdl.org> (raw)
In-Reply-To: <20060427213207.GA6709@steel.home>
On Thu, 27 Apr 2006, Alex Riesen wrote:
>
> NFS server: 2.6.15
> Client: 2.6.17-rc2
> mount options: tigra:/home /net/home nfs rw,nosuid,nodev,noatime,vers=3,rsize=8192,wsize=32768,hard,intr,proto=udp,timeo=7,retrans=3,addr=tigra 0 0
It's repeatable? Can you check if it goes away if your remove "intr"?
That said, the pack-file should all be written with the "sha1write()"
interface, which is very careful indeed.
I wonder if the _pack-file_ itself might be ok, and the problem is an
index file corruption. For some reason we check the index file first,
which is insane. We should check that the pack-file matches its _own_ SHA1
first, and check the index file second.
So the appended patch would be sensible: before we bother to look at the
index file at all, we should check the pack-file itself.
If it's just the index file that is corrupt, you may even have a chance to
recover the data.
The index file is also written with sha1write(), though, so I really don't
see where it would break. Unless you just simply literally have data
corruption on the server for some strange reason.
Linus
---
diff --git a/pack-check.c b/pack-check.c
index 84ed90d..e575879 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -29,12 +29,12 @@ static int verify_packfile(struct packed
pack_base = p->pack_base;
SHA1_Update(&ctx, pack_base, pack_size - 20);
SHA1_Final(sha1, &ctx);
- if (memcmp(sha1, index_base + index_size - 40, 20))
- return error("Packfile %s SHA1 mismatch with idx",
- p->pack_name);
if (memcmp(sha1, pack_base + pack_size - 20, 20))
return error("Packfile %s SHA1 mismatch with itself",
p->pack_name);
+ if (memcmp(sha1, index_base + index_size - 40, 20))
+ return error("Packfile %s SHA1 mismatch with idx",
+ p->pack_name);
/* Make sure everything reachable from idx is valid. Since we
* have verified that nr_objects matches between idx and pack,
next prev parent reply other threads:[~2006-04-27 22:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-27 21:32 bug: git-repack -a -d produces broken pack on NFS Alex Riesen
2006-04-27 22:11 ` Linus Torvalds [this message]
2006-04-27 22:17 ` Junio C Hamano
2006-04-27 22:29 ` Linus Torvalds
2006-04-27 22:44 ` Junio C Hamano
2006-04-27 22:18 ` Linus Torvalds
2006-04-28 22:27 ` Alex Riesen
2006-04-28 23:18 ` Linus Torvalds
2006-04-27 23:54 ` Linus Torvalds
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=Pine.LNX.4.64.0604271500500.3701@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=raa.lkml@gmail.com \
/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.
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 NNTP newsgroup(s).