git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Taylor Blau <me@ttaylorr.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, dstolee@microsoft.com
Subject: Re: [PATCH 0/2] midx: prevent against racily disappearing packs
Date: Wed, 25 Nov 2020 20:27:28 -0500	[thread overview]
Message-ID: <X78EgOPAVg1vQRo9@coredump.intra.peff.net> (raw)
In-Reply-To: <X77/LEwWlz9fjbYM@nand.local>

On Wed, Nov 25, 2020 at 08:04:44PM -0500, Taylor Blau wrote:

> > So we could perhaps BUG() in find_revindex_entry() instead of returning
> > NULL. A quick segfault accomplishes mostly the same thing, though the
> > BUG() could distinguish the two cases more clearly.
> 
> Yeah, a find_revindex_entry() that returns NULL means that the caller is
> probably dead in the water.
> 
> FWIW, this function gets touched by a series that I'm working on here:
> [1]. There, I think "returning NULL" is equivalent to "returning -1",
> and the problem exists there, too.
> 
> We could return a different negative number, call BUG(), or do nothing
> other than what's written. I don't have any strong feelings, though.

Yeah, I was suggesting _never_ returning a failure, and just hitting a
BUG() within the function. So it does not matter then how you represent
the error return type, because there isn't one. :)

Looking over the callers, there are actually a few that check the return
value and handle it sanely. I suspect they can never trigger in
practice, given that the other callers would all segfault, and we have
not seen any reports in the 15 years during which that has been the
case. But perhaps some of them can be triggered by bogus pack data that
nobody has ever run into in the real world.

At any rate, I am content to ignore it until somebody feels like digging
into each caller. A BUG() is only marginally better than an immediate
segfault anyway, and I'd prefer not to disrupt more substantive
improvements in the area.

-Peff

      reply	other threads:[~2020-11-26  1:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 17:17 [PATCH 0/2] midx: prevent against racily disappearing packs Taylor Blau
2020-11-25 17:17 ` [PATCH 1/2] packfile.c: protect against disappearing indexes Taylor Blau
2020-11-25 21:15   ` Junio C Hamano
2020-11-25 17:17 ` [PATCH 2/2] midx.c: protect against disappearing packs Taylor Blau
2020-11-25 21:22   ` Junio C Hamano
2020-11-25 21:13 ` [PATCH 0/2] midx: prevent against racily " Junio C Hamano
2020-11-26  0:48   ` Jeff King
2020-11-26  1:04     ` Taylor Blau
2020-11-26  1: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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=X78EgOPAVg1vQRo9@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).