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

Re: [PATCH] receive-pack: fix stale packfile locks when dying

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 9, 2023, 18:48 UTC
Message-ID
<xmqqsfedahhl.fsf@gitster.g>
In-Reply-To
<e16bd81bf9e251aa6959fbe10a3fbc215a4a1c12.1678367338.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 22 quoted lines
> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index cd5c7a28ef..0a6030d775 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -2186,6 +2186,12 @@ static const char *parse_pack_header(struct pack_header *hdr)
>  
>  static const char *pack_lockfile;
>  
> +static void unlink_pack_lockfile(void)
> +{
> +	if (pack_lockfile)
> +		unlink(pack_lockfile);
> +}
> +
>  static void push_header_arg(struct strvec *args, struct pack_header *hdr)
>  {
>  	strvec_pushf(args, "--pack_header=%"PRIu32",%"PRIu32,
> @@ -2281,6 +2287,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
>  		if (status)
>  			return "index-pack fork failed";
>  		pack_lockfile = index_pack_lockfile(child.out, NULL);
> +		atexit(unlink_pack_lockfile);
Hmph, why isn't this a straight application of tempfile API?
Previous: Taylor BlauNext: Junio C Hamano
Message 6 of 11 in “receive-pack: fix stale packfile locks when dying”
  1. receive-pack: fix stale packfile locks when dyingPatrick Steinhardt, Mar 9, 2023
  2. Jeff KingMar 9, 2023
  3. Patrick SteinhardtMar 10, 2023
  4. Jeff KingMar 10, 2023
  5. Taylor BlauMar 9, 2023
  6. Junio C HamanoMar 9, 2023
  7. Junio C HamanoMar 9, 2023
  8. receive-pack: fix stale packfile locks when dyingPatrick Steinhardt, Mar 10, 2023
  9. Jeff KingMar 10, 2023
  10. Patrick SteinhardtMar 10, 2023
  11. Jeff KingMar 10, 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.