Re: Bug: segfault during git-prune
- From
- Andy Parkins <andyparkins@gmail.com>
- Date
- Jun 28, 2007, 10:52 UTC
- Message-ID
- <200706281152.08591.andyparkins@gmail.com>
- In-Reply-To
- <200706281134.58453.andyparkins@gmail.com>
On Thursday 2007 June 28, Andy Parkins wrote:
> So, I think there are two faults: git-prune is deciding that the object is > a blob, when it's actually a commit; and git-prune's error handling is > broken in that case, because it's continuing with the NULL pointer returned > by check_commit() when obj->type != OBJ_COMMIT.
I can't figure it out I'm afraid. I've done a bit of back tracing and found the block that's generating the error; object.c:150
} else if (type == OBJ_COMMIT) {
struct commit *commit = lookup_commit(sha1);
parse_commit_buffer(commit, buffer, size);
if (!commit->buffer) {
commit->buffer = buffer;
eaten = 1;
}
obj = &commit->object;
}
Now, lookup_commit() is returning NULL because check_commit() is being called
with a struct object whose type field is not OBJ_COMMIT. Which it presumably
got from lookup_object(). gdb tells me the object returned by lookup_object()
is {parsed = 0, used = 0, type = 3, flags = 0,
sha1 = "\"\217\200e¹0\022\0165ü\f\025L#t\207«\002ÖJ"}Which seems to be the right hash, 228f8065b930120e35fc0c154c237487ab02d64a.
What should I do next? I don't understand why lookup_object() is returning an object with type blob instead of with type commit, when git-cat-file says that same object is a commit.
Andy
-- Dr Andy Parkins, M Eng (hons), MIET andyparkins@gmail.com