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

Re: [PATCH 4/5] builtin/repack.c: be more conservative with unsigned overflows

From
Taylor Blau <me@ttaylorr.com>
Date
Mar 5, 2021, 19:41 UTC
Message-ID
<YEKJTmbdZqdMx2j0@nand.local>
In-Reply-To
<xmqqr1kt9z12.fsf@gitster.c.googlers.com>
On Fri, Mar 05, 2021 at 11:32:57AM -0800, Junio C Hamano wrote:
> > Suggested-by: Junio C Hamano <gitster@pobox.com>
>
> I do not deserve this for my idle thinking-out-aloud speculation.
> You did all the thinking and work.
You're selling yourself short ;-).
Show 9 quoted lines
> I do not offhand know what a sensible and gentler fallback position
> would be for the factor multiplication, but presumably, if the right
> hand side of this ...
>
> >  		if (geometry_pack_weight(ours) < factor * total_size) {
>
> ... overflows, we can say it would definitely be larger than our
> weight and continue, instead of "no, we cannot multiply total with
> factor, as that would give us too big a number", I guess.

To answer your question about whether or not dying is sensible, I think that there are a couple of options. You could say, "I can no longer multiply total_size by factor without overflowing, so I'm not even going to bother considering additional packs". I guess that makes some progress in condensing packs, but that's as good as it would get, since the subsequent repack would also overflow instead of making further progress, so it would just get stuck.

Which makes me think that the other option, dying, is more sensible. But I think that this is all a moot point as you seem to indicate anyway, because having a large enough pack that we are verging on overflowing is likely not a real-world problem that we are going to deal with (at least right away).

Show 11 quoted lines
> I am OK to either (1) leave the code as-is without this patch, because
> the overflow would only affect the largest of packs and would be rare,
> and people who would notice when they hit it would probably are the ones
> with enough resource to diagnose, report and even give us a fix ;-)
> or (2) apply this patch as-is, because the only people who will see
> the die() would be the same ones affected by (1) above anyway.
>
> And applying this patch as-is would give better chance than (1) for
> the overflow to be noticed.
>
> So, let's queue the patch as-is.
Great, I'm fine with that. Thanks.
> Thanks.
Taylor
Previous: Junio C HamanoNext: Jeff King
Message 9 of 12 in “clean-ups to geometric repacking”
  1. 0/5 clean-ups to geometric repackingTaylor Blau, Mar 5, 2021
  2. 1/5 builtin/repack.c: do not repack single packs with --geometricTaylor Blau, Mar 5, 2021
  3. Junio C HamanoMar 5, 2021
  4. Taylor BlauMar 5, 2021
  5. Taylor BlauMar 5, 2021
  6. 2/5 t7703: test --geometric repack with loose objectsTaylor Blau, Mar 5, 2021
  7. 4/5 builtin/repack.c: be more conservative with unsigned overflowsTaylor Blau, Mar 5, 2021
  8. Junio C HamanoMar 5, 2021
  9. Taylor BlauMar 5, 2021
  10. Jeff KingMar 10, 2021
  11. 5/5 builtin/repack.c: reword comment around pack-objects flagsTaylor Blau, Mar 5, 2021
  12. 3/5 builtin/repack.c: assign pack split laterTaylor Blau, Mar 5, 2021

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.