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

Re: [PATCH 2/2] builtin/repack.c: avoid dir traversal in `collect_pack_filenames()`

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 10, 2023, 21:35 UTC
Message-ID
<xmqqa5w34fhk.fsf@gitster.g>
In-Reply-To
<b3d0d9308ef1a0aab8dd5a65354044568c65388b.1689017830.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
Show 5 quoted lines
> However, manually enumerating a repository's packs via `readdir()` is
> confusing and error-prone. It leads to frustrating inconsistencies
> between which packs Git considers to be part of a repository (i.e.,
> could be found in the list of packs from `get_all_packs()`), and which
> packs `collect_pack_filenames()` considers to meet the same criteria.
Makes sense.
> One gotcha here is that we have to ignore non-local packs, since the
> original version of `collect_pack_filenames()` only looks at the local
> pack directory to collect existing packs.
Yup.

Does this "fix" anything, or just makes the resulting code clearer and protects it from future breakage? I think it is the latter and not having any test is justified.

Thanks.
Previous: Taylor BlauNext: Taylor Blau
Message 6 of 10 in “repack: make `collect_pack_filenames()` consistent”
  1. 0/2 repack: make `collect_pack_filenames()` consistentTaylor Blau, Jul 10, 2023
  2. 1/2 builtin/repack.c: only repack `.pack`s that existTaylor Blau, Jul 10, 2023
  3. Junio C HamanoJul 10, 2023
  4. Taylor BlauJul 11, 2023
  5. 2/2 builtin/repack.c: avoid dir traversal in `collect_pack_filenames()`Taylor Blau, Jul 10, 2023
  6. Junio C HamanoJul 10, 2023
  7. Taylor BlauJul 11, 2023
  8. 0/2 repack: make `collect_pack_filenames()` consistentTaylor Blau, Jul 11, 2023
  9. 1/2 builtin/repack.c: only repack `.pack`s that existTaylor Blau, Jul 11, 2023
  10. 2/2 builtin/repack.c: avoid dir traversal in `collect_pack_filenames()`Taylor Blau, Jul 11, 2023

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.