git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Subject: Re: Bug: segfault during git-prune
Date: Thu, 28 Jun 2007 11:52:04 +0100	[thread overview]
Message-ID: <200706281152.08591.andyparkins@gmail.com> (raw)
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

  reply	other threads:[~2007-06-28 10:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-28 10:34 Bug: segfault during git-prune Andy Parkins
2007-06-28 10:52 ` Andy Parkins [this message]
2007-06-28 15:59 ` Linus Torvalds
2007-06-28 16:09   ` Linus Torvalds
2007-06-28 22:21   ` Andy Parkins
2007-06-28 22:31     ` Linus Torvalds
2007-06-29 12:39       ` Andy Parkins
2007-07-02 10:00       ` Andy Parkins
2007-07-02 11:45         ` Linus Torvalds
2007-07-02 13:25           ` Andy Parkins
2007-07-02 21:01             ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200706281152.08591.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).