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

Re: Bug: segfault during git-prune

From
APAndy 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
Previous: Andy ParkinsNext: Linus Torvalds
Message 2 of 11 in “Bug: segfault during git-prune”
  1. Andy ParkinsJun 28, 2007
  2. Andy ParkinsJun 28, 2007
  3. Linus TorvaldsJun 28, 2007
  4. Linus TorvaldsJun 28, 2007
  5. Andy ParkinsJun 28, 2007
  6. Linus TorvaldsJun 28, 2007
  7. Andy ParkinsJun 29, 2007
  8. Andy ParkinsJul 2, 2007
  9. Linus TorvaldsJul 2, 2007
  10. Andy ParkinsJul 2, 2007
  11. Linus TorvaldsJul 2, 2007

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.