git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
DSDennis Stosberg <dennis@stosberg.net>
Date
May 28, 2006, 19:08 UTC
Message-ID
<20060528190808.G7cae5a8a@leonov.stosberg.net>

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(-)
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
Message 1 of 1 in “git-write-tree writes garbage on sparc64”
  1. git-write-tree writes garbage on sparc64Dennis Stosberg, May 28, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.