Skip to content

Commit

Permalink
git-write-tree writes garbage on sparc64
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Dennis Stosberg authored and Junio C Hamano committed May 28, 2006
1 parent b6c4a48 commit ac58c7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ static int ce_write(SHA_CTX *context, int fd, void *data, unsigned int len)
}

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);
Expand Down

0 comments on commit ac58c7b

Please sign in to comment.