git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff: check for merge bases before assigning sym->base

From
Jeff King <peff@peff.net>
Date
Jul 9, 2020, 23:02 UTC
Message-ID
<20200709230251.GC664420@coredump.intra.peff.net>
In-Reply-To
<CAPx1GvfLpTR-weVQcWm5iX59cmCh2Gad+vU=ESqqLkCq-O5RmA@mail.gmail.com>
On Wed, Jul 08, 2020 at 10:05:44AM -0700, Chris Torek wrote:
Show 8 quoted lines
> > I don't see anything within this function guaranteeing that rpos is set,
> > either, though I suspect it is OK due to how the revision parser works.
> 
> Yes, I am depending on the revision parser to balance the left and
> right items.  I thought about having a BUG check but it seemed
> unnecessary.  On the other hand, I'm avoiding depending on its
> *placement* of left and right items.  Being more defensive might
> be good here.

I could go either way with adding a BUG (and it definitely doesn't need to hold up this fix). I strongly suspect that getting a LEFT without a RIGHT would be a bug in the rev parser, not this code. But seeing a BUG() here might be a more friendly way of being informed of that than a segfault. :)

-Peff
Previous: Chris Torek
Message 4 of 4 in “t4068 test failure with -fsanitize=address”
  1. brian m. carlsonJul 7, 2020
  2. diff: check for merge bases before assigning sym->baseJeff King, Jul 8, 2020
  3. Chris TorekJul 8, 2020
  4. Jeff KingJul 9, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.