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

Re: [PATCH] builtin/repack.c: prune unreachable objects with `--expire-to`

From
Taylor Blau <me@ttaylorr.com>
Date
Dec 1, 2024, 04:24 UTC
Message-ID
<Z0vlD7/vOhot0qwc@nand.local>
In-Reply-To
<48438876fb42a889110e100a6c42ca84e93aac49.1733011259.git.me@ttaylorr.com>
On Sat, Nov 30, 2024 at 07:01:03PM -0500, Taylor Blau wrote:
Show 15 quoted lines
> diff --git a/builtin/repack.c b/builtin/repack.c
> index d6bb37e84ae..57cab72dcf5 100644
> --- a/builtin/repack.c
> +++ b/builtin/repack.c
> @@ -1553,6 +1553,21 @@ int cmd_repack(int argc,
>  							&existing);
>  		if (show_progress)
>  			opts |= PRUNE_PACKED_VERBOSE;
> +
> +		if (expire_to && *expire_to) {
> +			char *alt = dirname(xstrdup(expire_to));
> +			size_t len = strlen(alt);
> +
> +			if (strip_suffix(alt, "pack", &len) &&
> +			    is_dir_sep(alt[len - 1])) {
Argh. This clearly needs a bounds check to ensure that 'len >= 1'.
I suspect that passing "--expire-to=pack/xyz" would segfault.

Thanks, Taylor

Previous: Taylor BlauNext: Jeff King
Message 2 of 4 in “builtin/repack.c: prune unreachable objects with `--expire-to`”
  1. builtin/repack.c: prune unreachable objects with `--expire-to`Taylor Blau, Dec 1, 2024
  2. Taylor BlauDec 1, 2024
  3. Jeff KingDec 1, 2024
  4. ZheNing HuJan 15, 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.