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

Re: [PATCH 2/5] midx-write: put failing response value back

From
Taylor Blau <me@ttaylorr.com>
Date
Aug 29, 2025, 01:26 UTC
Message-ID
<aLEBwC9Oky+NV/Vk@nand.local>
In-Reply-To
<xmqq1povuqdr.fsf@gitster.g>
On Thu, Aug 28, 2025 at 01:45:36PM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: Derrick Stolee <stolee@gmail.com>
> >
> > This instance of setting the result to 1 before going to cleanup was
> > accidentally removed in fcb2205b77 (midx: implement support for writing
> > incremental MIDX chains, 2024-08-06).
> >
> > Signed-off-by: Derrick Stolee <stolee@gmail.com>
> > ---
> >  midx-write.c | 1 +
> >  1 file changed, 1 insertion(+)
>
> The cover letter made it sound as if [1/5] was the only fix and the
> rest was clean-up, but unless all callers of write_midx_internal()
> ignores the return value from it, this surely would change the
> behaviour of the program, no?

I think the cover letter is saying that only the first patch is required to fix the crash that was reported, and the rest are clean-ups.

Not that this isn't a bug in its own right, but it's definitely distinct from the one that is addressed in the previous patch.

Show 18 quoted lines
> And the results from write-midx_file_only(), write_midx_file(), and
> expire_midx_packs(), the three callers of this _internal() function,
> all seem to be used in builtin/multi-pack-index.c so wouldn't this
> also be a fix?
>
> Not that I endorse "0 is success and any non-zero value is an error",
> but this does not look like a mere clean-up to me.
>
> > diff --git a/midx-write.c b/midx-write.c
> > index d8f9679868..85b2d471ef 100644
> > --- a/midx-write.c
> > +++ b/midx-write.c
> > @@ -1106,6 +1106,7 @@ static int write_midx_internal(struct repository *r, const char *object_dir,
> >  			m = m->base_midx;
> >  		}
> >  	} else if (ctx.m && fill_packs_from_midx(&ctx)) {
> > +		result = 1;
> >  		goto cleanup;

It might be nice to have a test that confirms this behavior (though the changes look obviously correct to me). It should suffice to write a MIDX, drop one of its packs, and then try to write it again with a new pack.

Thanks, Taylor

Previous: Junio C HamanoNext: Derrick Stolee via GitGitGadget
Message 8 of 47 in “midx-write: fix segfault and do several cleanups”
  1. 0/5 midx-write: fix segfault and do several cleanupsDerrick Stolee via GitGitGadget, Aug 28, 2025
  2. 1/5 midx-write: only load initialized packsDerrick Stolee via GitGitGadget, Aug 28, 2025
  3. Junio C HamanoAug 28, 2025
  4. Taylor BlauAug 29, 2025
  5. Derrick StoleeAug 30, 2025
  6. 2/5 midx-write: put failing response value backDerrick Stolee via GitGitGadget, Aug 28, 2025
  7. Junio C HamanoAug 28, 2025
  8. Taylor BlauAug 29, 2025
  9. 3/5 midx-write: use cleanup when incremental midx failsDerrick Stolee via GitGitGadget, Aug 28, 2025
  10. Junio C HamanoAug 28, 2025
  11. Taylor BlauAug 29, 2025
  12. Derrick StoleeAug 30, 2025
  13. 4/5 midx-write: use uint32_t for preferred_pack_idxDerrick Stolee via GitGitGadget, Aug 28, 2025
  14. Junio C HamanoAug 28, 2025
  15. Taylor BlauAug 29, 2025
  16. 5/5 midx-write: reenable signed comparison errorsDerrick Stolee via GitGitGadget, Aug 28, 2025
  17. Junio C HamanoAug 28, 2025
  18. Taylor BlauAug 29, 2025
  19. Taylor BlauAug 29, 2025
  20. 0/6 midx-write: fix segfault and do several cleanupsDerrick Stolee via GitGitGadget, Aug 30, 2025
  21. 1/6 midx-write: only load initialized packsDerrick Stolee via GitGitGadget, Aug 30, 2025
  22. Patrick SteinhardtSep 3, 2025
  23. Derrick StoleeSep 5, 2025
  24. 2/6 midx-write: put failing response value backDerrick Stolee via GitGitGadget, Aug 30, 2025
  25. Patrick SteinhardtSep 3, 2025
  26. Derrick StoleeSep 5, 2025
  27. 3/6 midx-write: use cleanup when incremental midx failsDerrick Stolee via GitGitGadget, Aug 30, 2025
  28. Patrick SteinhardtSep 3, 2025
  29. 4/6 midx-write: use uint32_t for preferred_pack_idxDerrick Stolee via GitGitGadget, Aug 30, 2025
  30. Patrick SteinhardtSep 3, 2025
  31. Derrick StoleeSep 5, 2025
  32. 5/6 midx-write: reenable signed comparison errorsDerrick Stolee via GitGitGadget, Aug 30, 2025
  33. Patrick SteinhardtSep 3, 2025
  34. 6/6 midx-write: simplify error casesDerrick Stolee via GitGitGadget, Aug 30, 2025
  35. Patrick SteinhardtSep 3, 2025
  36. Junio C HamanoSep 3, 2025
  37. 0/6 midx-write: fix segfault and do several cleanupsDerrick Stolee via GitGitGadget, Sep 5, 2025
  38. 1/6 midx-write: only load initialized packsDerrick Stolee via GitGitGadget, Sep 5, 2025
  39. 2/6 midx-write: put failing response value backDerrick Stolee via GitGitGadget, Sep 5, 2025
  40. 3/6 midx-write: use cleanup when incremental midx failsDerrick Stolee via GitGitGadget, Sep 5, 2025
  41. 4/6 midx-write: use uint32_t for preferred_pack_idxDerrick Stolee via GitGitGadget, Sep 5, 2025
  42. 5/6 midx-write: reenable signed comparison errorsDerrick Stolee via GitGitGadget, Sep 5, 2025
  43. 6/6 midx-write: simplify error casesDerrick Stolee via GitGitGadget, Sep 5, 2025
  44. Junio C HamanoSep 5, 2025
  45. Derrick StoleeSep 5, 2025
  46. Taylor BlauSep 11, 2025
  47. Junio C HamanoSep 11, 2025

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.