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

Re: [PATCH] pack-redundant: fix crash when one packfile in repo

From
Jeff King <peff@peff.net>
Date
Dec 16, 2020, 18:46 UTC
Message-ID
<X9pWDRAn7GmJgt7Z@coredump.intra.peff.net>
In-Reply-To
<20201216100952.16890-1-worldhello.net@gmail.com>
On Wed, Dec 16, 2020 at 05:09:52AM -0500, Jiang Xin wrote:
> Command `git pack-redundant --all` will crash if there is only one
> packfile in the repository.  This is because, if there is only one
> packfile in local_packs, `cmp_local_packs` will do nothing and will
> leave `pl->unique_objects` as uninitialized.

Thanks, that makes sense. And I'm glad I waited to get the opinion of somebody much more clueful. Mine was a band-aid, but yours is hitting the root cause and will help any other downstream code that assumes unique_objects isn't NULL.

>  builtin/pack-redundant.c  |  6 ++++
>  t/t5323-pack-redundant.sh | 65 +++++++++++++++++++++++++++++----------

The new test coverage makes sense, I think, though as Junio noted, it should be done independent of the $git_pack_redundant change (which will also make the diff a lot easier to review).

-Peff
Previous: Junio C HamanoNext: Daniel Klauer
Message 9 of 11 in “bug report: "git pack-redundant --all" crash in minimize()”
  1. Daniel C. KlauerDec 15, 2020
  2. Jeff KingDec 15, 2020
  3. Junio C HamanoDec 15, 2020
  4. Jiang XinDec 16, 2020
  5. pack-redundant: fix crash when one packfile in repoJiang Xin, Dec 16, 2020
  6. Junio C HamanoDec 16, 2020
  7. pack-redundant: fix crash when one packfile in repoJiang Xin, Dec 17, 2020
  8. Junio C HamanoDec 17, 2020
  9. Jeff KingDec 16, 2020
  10. Daniel KlauerDec 16, 2020
  11. Jeff KingDec 16, 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.