threads / patch / 4318

patchgit-write-tree writes garbage on sparc64

Subject: [PATCH] git-write-tree writes garbage on sparc64

## tl;dr

One message between May 28, 2006 and May 28, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Dennis Stosberg· May 28, 2006, 19:08 UTC · lore

In the "next" branch, write_index_ext_header() writes garbage on a 64-bit big-endian machine; the written index file will be unreadable. I noticed this on NetBSD/sparc64. Reproducible with:

$ git init-db $ :>file $ git-update-index --add file $ git-write-tree $ git-update-index error: index uses extension, which we do not understand fatal: index file corrupt

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 read-cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to read-cache.c +1 −1
diff --git a/read-cache.c b/read-cache.c
index 36bd4ea..c499c51 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -826,7 +826,7 @@ static int ce_write(SHA_CTX *context, in
 }
 
 static int write_index_ext_header(SHA_CTX *context, int fd,
-				  unsigned long ext, unsigned long sz)
+				  unsigned int ext, unsigned int sz)
 {
 	ext = htonl(ext);
 	sz = htonl(sz);
-- 
1.3.3.g3c38f

← back to recent threads