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

Re: [PATCH 2/2] built-in rebase: reinstate `checkout -q` behavior where appropriate

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 12, 2018, 11:11 UTC
Message-ID
<nycvar.QRO.7.76.6.1811121211040.39@tvgsbejvaqbjf.bet>
In-Reply-To
<20181109195934.GC4938@sigill.intra.peff.net>
Hi Peff,
On Fri, 9 Nov 2018, Jeff King wrote:
Show 23 quoted lines
> On Fri, Nov 09, 2018 at 06:21:41PM +0100, Johannes Schindelin wrote:
> 
> > Actually, you got me thinking about the desc.buffer. And I think there is
> > one corner case where it could cause a problem: `struct tree_desc desc[2]`
> > does not initialize the buffers to NULL. And what if
> > fill_tree_descriptor() function returns NULL? Then the buffer is still
> > uninitialized.
> > 
> > In practice, our *current* version of fill_tree_descriptor() never returns
> > NULL if the oid parameter is non-NULL. It would die() in the error case
> > instead (bad!). So to prepare for a less bad version, I'd rather
> > initialize the `desc` array and be on the safe (and easier to reason
> > about) side.
> 
> Yeah, I agree with all of that.
> 
> One solution would just be to increment only after success:
> 
>   if (fill_tree_descriptor(&desc[nr], ..) < 0)
> 	goto error;
>   nr++; /* now we know it's valid! */
> 
> But there are lots of alternatives.  :)
True. I simply prefer to initialize it and be done with it. ;-)

Ciao, Dscho

Previous: Jeff KingNext: Junio C Hamano
Message 9 of 18 in “Fix built-in rebase perf regression”
  1. 0/2 Fix built-in rebase perf regressionJohannes Schindelin via GitGitGadget, Nov 9, 2018
  2. 1/2 rebase: consolidate clean-up code before leaving reset_head()Johannes Schindelin via GitGitGadget, Nov 9, 2018
  3. Jeff KingNov 9, 2018
  4. Johannes SchindelinNov 9, 2018
  5. 2/2 built-in rebase: reinstate `checkout -q` behavior where appropriateJohannes Schindelin via GitGitGadget, Nov 9, 2018
  6. Jeff KingNov 9, 2018
  7. Johannes SchindelinNov 9, 2018
  8. Jeff KingNov 9, 2018
  9. Johannes SchindelinNov 12, 2018
  10. Junio C HamanoNov 12, 2018
  11. Johannes SchindelinNov 12, 2018
  12. Junio C HamanoNov 13, 2018
  13. Junio C HamanoNov 13, 2018
  14. 0/3 Fix built-in rebase perf regressionJohannes Schindelin via GitGitGadget, Nov 12, 2018
  15. 1/3 rebase: consolidate clean-up code before leaving reset_head()Johannes Schindelin via GitGitGadget, Nov 12, 2018
  16. 2/3 rebase: prepare reset_head() for more flagsJohannes Schindelin via GitGitGadget, Nov 12, 2018
  17. 3/3 built-in rebase: reinstate `checkout -q` behavior where appropriateJohannes Schindelin via GitGitGadget, Nov 12, 2018
  18. Johannes SchindelinNov 12, 2018

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.