From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Mathias L. Baumann" <mathias.baumann@sociomantic.com>,
Victor Leschuk <vleschuk@gmail.com>,
git@vger.kernel.org, vleschuk@accesssoftek.com
Subject: Re: [PATCH] add_submodule_odb: initialize alt_odb list earlier
Date: Wed, 28 Oct 2015 13:27:58 -0400 [thread overview]
Message-ID: <20151028172758.GA21851@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqa8r3m2xq.fsf@gitster.mtv.corp.google.com>
On Wed, Oct 28, 2015 at 08:24:17AM -0700, Junio C Hamano wrote:
> > Note that we can remove the prepare_alt_odb call from the
> > end. It is guaranteed to be a noop, since we will have
> > called it earlier.
>
> Thanks for a quick and detailed diagnosis and a fix.
>
> The removal is correct, but even without this fix, the order of
> calls in the original should have screamed "bug" loudly at us, I
> think. We shouldn't be reading data from alternates file without
> first preparing the place we read data into.
Yeah, I agree. I spent a long time trying to figure out if that
prepare_alt_odb was actually doing something useful (like if it was
needed to somehow "cement" the new alt into place).
But I don't think it was.
In the majority of cases, it was a noop (we had already prepared when we
looked up the first object). But for other cases...
- if read_info_alternates actually did something, we segfaulted (i.e.,
this bug)
- otherwise, we would prepare on _top_ of what we just added to the
list, which was probably buggy (I didn't dig far enough to see if
prepare_alt_odb() would overwrite what we just added to the list).
So some pretty dark corners of the code. :)
-Peff
prev parent reply other threads:[~2015-10-28 17:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-28 11:58 Bug: Segfault when doing "git diff" Mathias L. Baumann
2015-10-28 12:24 ` Victor Leschuk
2015-10-28 13:35 ` Mathias L. Baumann
2015-10-28 13:54 ` Victor Leschuk
2015-10-28 14:07 ` [PATCH] add_submodule_odb: initialize alt_odb list earlier Jeff King
2015-10-28 15:24 ` Junio C Hamano
2015-10-28 17:27 ` Jeff King [this message]
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=20151028172758.GA21851@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mathias.baumann@sociomantic.com \
--cc=vleschuk@accesssoftek.com \
--cc=vleschuk@gmail.com \
/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).