git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzvetan Mikov <tmikov@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Thomas Rast <trast@inf.ethz.ch>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Eric Vander Weele <ericvw@gmail.com>
Subject: Re: [PATCH] line-log: fix crash when --first-parent is used
Date: Mon, 3 Nov 2014 14:09:35 -0800	[thread overview]
Message-ID: <CACt9tMj2GBWC6yRpfKXUk1hnh2ZyBqoV5HDmL0cjfxCiawHT=g@mail.gmail.com> (raw)
In-Reply-To: <xmqqoasoq9vh.fsf@gitster.dls.corp.google.com>

On Mon, Nov 3, 2014 at 12:58 PM, Junio C Hamano <gitster@pobox.com> wrote:

>> line-log tries to access all parents of a commit, but only the first
>> parent has been loaded if "--first-parent" is specified, resulting
>> in a crash.
>>
>> Limit the number of parents to one if "--first-parent" is specified.
>>

> [...]
> Tzvetan, can we have a test for this one?

Here is a sequence of commands to reproduce the crash:

git init
echo "1" > a.txt && git add a.txt && git commit -m "a"
git checkout -b branch
echo "2" > b.txt && git add b.txt && git commit -m "b"
git checkout master
git merge branch --no-ff -m "merge"
git log --first-parent -L 1,1:a.txt

I am not sure whether you have a requirement for a formal test
included with the patch, but if there is one, I am happy to
rework it.

This is a very simple fix for the crash, though possibly
a "real" comprehensive fix may be needed. I am not sure.
The real cause is that with "--first-parent" some commit
objects are never loaded from disk but may still be accessed.

(sorry about my formatting - have to use GMail)

regards,
Tzvetan

  reply	other threads:[~2014-11-03 22:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 19:43 [PATCH] line-log: fix crash when --first-parent is used Tzvetan Mikov
2014-11-03 20:58 ` Junio C Hamano
2014-11-03 22:09   ` Tzvetan Mikov [this message]
2014-11-04  9:34     ` Michael J Gruber
2014-11-04 20:33 ` [PATCH v2] " Tzvetan Mikov
2014-11-04 21:24   ` Junio C Hamano
2014-11-04 21:41     ` Tzvetan Mikov

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='CACt9tMj2GBWC6yRpfKXUk1hnh2ZyBqoV5HDmL0cjfxCiawHT=g@mail.gmail.com' \
    --to=tmikov@gmail.com \
    --cc=ericvw@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    --cc=trast@inf.ethz.ch \
    /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).