Git development
 help / color / mirror / Atom feed
* error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx
@ 2007-06-26 20:03 Tjernlund
  2007-06-26 20:45 ` error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d32 55bfef95601890afd80709.idx Linus Torvalds
  2007-06-26 20:55 ` error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx David Woodhouse
  0 siblings, 2 replies; 4+ messages in thread
From: Tjernlund @ 2007-06-26 20:03 UTC (permalink / raw)
  To: git

Did this and got a small error that I don't think should be there:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6

cd linux-2.6
git gc
cd ..

git clone --reference linux-2.6 ssh://git.infradead.org/~/public_git/jffs2_mtd_patches
Initialized empty Git repository in /usr/local/src/jffs2_mtd_patches/.git/
The authenticity of host 'git.infradead.org (18.85.46.34)' can't be established.
RSA key fingerprint is 45:df:f2:54:81:cf:42:05:1d:59:bb:dd:60:b5:0e:81.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'git.infradead.org' (RSA) to the list of known hosts.
remote: Generating pack...
remote: Done counting 0 objects.
Indexing 0 objects...
remote: Total 0 (delta 0), reused 0 (delta 0)
error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx
Checking 21649 files out...
 100% (21649/21649) done

git --version
git version 1.5.2.2

the ~ in above ssh: is jocke

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d32 55bfef95601890afd80709.idx
  2007-06-26 20:03 error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx Tjernlund
@ 2007-06-26 20:45 ` Linus Torvalds
  2007-06-26 21:14   ` Tjernlund
  2007-06-26 20:55 ` error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx David Woodhouse
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2007-06-26 20:45 UTC (permalink / raw)
  To: Tjernlund; +Cc: git



On Tue, 26 Jun 2007, Tjernlund wrote:
>
> Did this and got a small error that I don't think should be there:

Heh. I think I see what's wrong..

> Indexing 0 objects...
> remote: Total 0 (delta 0), reused 0 (delta 0)

Ok, there were no objects that weren't in the reference repo. So far so 
good.

But:

> error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx

I think this is because of that zero size:

                /*
                 * Minimum size:
                 *  - 8 bytes of header
                 *  - 256 index entries 4 bytes each
                 *  - 20-byte sha1 entry * nr
                 *  - 4-byte crc entry * nr
                 *  - 4-byte offset entry * nr
                 *  - 20-byte SHA1 of the packfile
                 *  - 20-byte SHA1 file checksum
                 * And after the 4-byte offset table might be a
                 * variable sized table containing 8-byte entries
                 * for offsets larger than 2^31.
                 */
                unsigned long min_size = 8 + 4*256 + nr*(20 + 4 + 4) + 20 + 20;
                if (idx_size < min_size || idx_size > min_size + (nr - 1)*8) {

Notice the "(nr - 1)*8" thing. And notice how "nr-1" underflows when nr is 
zero..

I bet it goes away if you remove the "-1", or if you do something like 
this (totally untested!) patch.

		Linus

---
diff --git a/sha1_file.c b/sha1_file.c
index 7628ee9..f2b1ae0 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -510,7 +510,10 @@ static int check_packed_git_idx(const char *path,  struct packed_git *p)
 		 * for offsets larger than 2^31.
 		 */
 		unsigned long min_size = 8 + 4*256 + nr*(20 + 4 + 4) + 20 + 20;
-		if (idx_size < min_size || idx_size > min_size + (nr - 1)*8) {
+		unsigned long max_size = min_size;
+		if (nr)
+			max_size += (nr - 1)*8;
+		if (idx_size < min_size || idx_size > max_size) {
 			munmap(idx_map, idx_size);
 			return error("wrong index file size in %s", path);
 		}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx
  2007-06-26 20:03 error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx Tjernlund
  2007-06-26 20:45 ` error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d32 55bfef95601890afd80709.idx Linus Torvalds
@ 2007-06-26 20:55 ` David Woodhouse
  1 sibling, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2007-06-26 20:55 UTC (permalink / raw)
  To: Tjernlund; +Cc: git

On Tue, 2007-06-26 at 22:03 +0200, Tjernlund wrote:
> Did this and got a small error that I don't think should be there:
> 
> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6
> 
> cd linux-2.6
> git gc
> cd ..
> 
> git clone --reference linux-2.6 ssh://git.infradead.org/~/public_git/jffs2_mtd_patches

Your jffs2_mtd_patches tree is just a clone of
git://git.infradead.org/mtd-2.6.git, isn't it?

I get the same error when cloning that:

pmac /home/dwmw2/x $ git-clone --reference /pmac/git/linux-2.6 git://git.infradead.org/mtd-2.6.git
Initialized empty Git repository in /home/dwmw2/x/mtd-2.6/.git/
remote: Generating pack...
remote: Done counting 0 objects.
remote: Total 0 (delta 0), reused 0 (delta 0)
Indexing 0 objects...
error: wrong index file size in /home/dwmw2/x/mtd-2.6/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx
Checking 21649 files out...
 100% (21649/21649) done

The mtd-2.6.git tree has _no_ objects of its own at the moment; I've
committed nothing since Linus' last pull, and there's a weekly
'git-repack -a -l -d', which will remove any local objects which are
already in git://git.infradead.org/linux-2.6.git. Cloning linux-2.6.git
from there works fine, but cloning mtd-2.6.git shows the above error.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d32 55bfef95601890afd80709.idx
  2007-06-26 20:45 ` error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d32 55bfef95601890afd80709.idx Linus Torvalds
@ 2007-06-26 21:14   ` Tjernlund
  0 siblings, 0 replies; 4+ messages in thread
From: Tjernlund @ 2007-06-26 21:14 UTC (permalink / raw)
  To: 'Linus Torvalds'; +Cc: git

 

> -----Original Message-----
> From: Linus Torvalds [mailto:torvalds@linux-foundation.org] 
> Sent: den 26 juni 2007 22:45
> To: Tjernlund
> Cc: git@vger.kernel.org
> Subject: Re: error: wrong index file size in 
> /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3
> ee5e6b4b0d32 55bfef95601890afd80709.idx
> 
> 
> 
> On Tue, 26 Jun 2007, Tjernlund wrote:
> >
> > Did this and got a small error that I don't think should be there:
> 
> Heh. I think I see what's wrong..
> 
> > Indexing 0 objects...
> > remote: Total 0 (delta 0), reused 0 (delta 0)
> 
> Ok, there were no objects that weren't in the reference repo. 
> So far so 
> good.
> 
> But:
> 
> > error: wrong index file size in 
> /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3
ee5e6b4b0d3255bfef95601890afd80709.idx
> 
> I think this is because of that zero size:
> 
>                 /*
>                  * Minimum size:
>                  *  - 8 bytes of header
>                  *  - 256 index entries 4 bytes each
>                  *  - 20-byte sha1 entry * nr
>                  *  - 4-byte crc entry * nr
>                  *  - 4-byte offset entry * nr
>                  *  - 20-byte SHA1 of the packfile
>                  *  - 20-byte SHA1 file checksum
>                  * And after the 4-byte offset table might be a
>                  * variable sized table containing 8-byte entries
>                  * for offsets larger than 2^31.
>                  */
>                 unsigned long min_size = 8 + 4*256 + nr*(20 + 
> 4 + 4) + 20 + 20;
>                 if (idx_size < min_size || idx_size > 
> min_size + (nr - 1)*8) {
> 
> Notice the "(nr - 1)*8" thing. And notice how "nr-1" 
> underflows when nr is 
> zero..
> 
> I bet it goes away if you remove the "-1", or if you do 
> something like 
> this (totally untested!) patch.
> 
> 		Linus

[SNIP patch]

Tested your patch and the error went away, many thanks

 Jocke 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-26 21:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-26 20:03 error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx Tjernlund
2007-06-26 20:45 ` error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d32 55bfef95601890afd80709.idx Linus Torvalds
2007-06-26 21:14   ` Tjernlund
2007-06-26 20:55 ` error: wrong index file size in /usr/local/src/jffs2_mtd_patches/.git/objects/pack/pack-da39a3ee5e6b4b0d3255bfef95601890afd80709.idx David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox