git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: git@vger.kernel.org
Subject: Re: git-stash segfaults ...
Date: Mon, 20 Aug 2007 22:02:55 +0200	[thread overview]
Message-ID: <20070820200255.GD5544@steel.home> (raw)
In-Reply-To: <20070820174427.GC7206@artemis.corp>

Pierre Habouzit, Mon, Aug 20, 2007 19:44:27 +0200:
>   When you don't use it from the root of the tree: I was in a subdir of
> my git tree, trying to do:
> 
>   git stash apply
> 
>   and I had:
> 
>   $ git stash apply
>   error: missing object referenced by
>   '0ca54c1fba7fea7dca8a1cc59bce2b2849f26d20' Segmentation fault
> 
>   going in the root of the repository (where .git is), all went fine.

Can't reproduce, but... There are places where the result of the
function which gives this message (deref_tag from tag.c) is not
checked for NULL and used. merge-recursive (used by git-stash) is one
of them (and sha1_name is another).

Pierre, could you please try the patch below and see if the crash is
replaced with a failure?

BTW, is there something unusual happening to that repo? Like manual
object removing, or removal of repo your repo was cloned from, using
something like "git clone -l -s", maybe?

diff --git a/merge-recursive.c b/merge-recursive.c
index 16f6a0f..464fc4e 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1701,6 +1701,8 @@ static struct commit *get_ref(const char *ref)
 	if (get_sha1(ref, sha1))
 		die("Could not resolve ref '%s'", ref);
 	object = deref_tag(parse_object(sha1), ref, strlen(ref));
+	if (!object)
+		die("Could not resolve ref '%s' down to object", ref);
 	if (object->type == OBJ_TREE)
 		return make_virtual_commit((struct tree*)object,
 			better_branch_name(ref));

  reply	other threads:[~2007-08-20 20:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 17:44 git-stash segfaults Pierre Habouzit
2007-08-20 20:02 ` Alex Riesen [this message]
2007-08-21  6:05   ` Jeff King
2007-08-21  6:54     ` Junio C Hamano
2007-08-21  7:08       ` Jeff King
2007-08-20 20:44 ` Junio C Hamano
2007-08-20 20:50   ` Pierre Habouzit

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=20070820200255.GD5544@steel.home \
    --to=raa.lkml@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).