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

Re: [PATCH v2] reftable: write correct max_update_index to header

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 23, 2025, 18:24 UTC
Message-ID
<xmqq5xm5s80e.fsf@gitster.g>
In-Reply-To
<xmqqbjvxs8me.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>> While this patch was merged to next, Dscho reported that it was flaky
>> on macos pipeline. On further investigation I found this was easily
>> reproducible when the leak sanitizer was turned on and the reftable
>> tests were run. The fix was simply to add the missing 0 initialization.
>
> If it is already _in_ 'next', please turn it into a relative patch
> on top of it, instead of replacing it.

For now, I have tentatively created the following and will queue on a separate kn/reflog-migration-fix-fix topic (which would be ahead of kn/reflog-migration-fix topic by this one commit), in the hope that it can be replaced with a version with proper commit log message that describes what bugs in the original "fix" are addressed, how they are caused (e.g., how does it lead to the breakage to forget clearing of arg->max_index in the first hunk had?), and what their fixes are.

Thanks.
--- >8 ---
From: Karthik Nayak <karthik.188@gmail.com>
Date: Fri, 20 Dec 2024 13:58:37 +0100
Subject: [PATCH] SQUASH - needs to describe the breakage and fix in v1
---
 refs/reftable-backend.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 68db2baa8f..bb658826fe 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -920,6 +920,7 @@ static int prepare_transaction_update(struct write_transaction_table_arg **out,
 		arg->updates_nr = 0;
 		arg->updates_alloc = 0;
 		arg->updates_expected = 0;
+		arg->max_index = 0;
 	}
 
 	arg->updates_expected++;
@@ -1502,10 +1503,9 @@ static int reftable_be_transaction_finish(struct ref_store *ref_store UNUSED,
 	struct reftable_transaction_data *tx_data = transaction->backend_data;
 	int ret = 0;
 
-	if (tx_data->args)
-		tx_data->args->max_index = transaction->max_index;
-
 	for (size_t i = 0; i < tx_data->args_nr; i++) {
+		tx_data->args[i].max_index = transaction->max_index;
+
 		ret = reftable_addition_add(tx_data->args[i].addition,
 					    write_transaction_table, &tx_data->args[i]);
 		if (ret < 0)
-- 
2.48.1-259-gf9754493bb
Previous: Junio C HamanoNext: Karthik Nayak
Message 14 of 21 in “Bug in 2.48 with `git refs migrate`”
  1. brian m. carlsonJan 13, 2025
  2. Patrick SteinhardtJan 13, 2025
  3. Karthik NayakJan 15, 2025
  4. Junio C HamanoJan 15, 2025
  5. Karthik NayakJan 16, 2025
  6. brian m. carlsonJan 16, 2025
  7. Karthik NayakJan 16, 2025
  8. brian m. carlsonJan 16, 2025
  9. Junio C HamanoJan 17, 2025
  10. Karthik NayakJan 17, 2025
  11. Karthik NayakJan 17, 2025
  12. reftable: write correct max_update_index to headerKarthik Nayak, Jan 23, 2025
  13. Junio C HamanoJan 23, 2025
  14. Junio C HamanoJan 23, 2025
  15. refs: fix uninitialized memory access of `max_index`Karthik Nayak, Jan 24, 2025
  16. Patrick SteinhardtJan 24, 2025
  17. Karthik NayakJan 24, 2025
  18. Patrick SteinhardtJan 27, 2025
  19. Junio C HamanoJan 27, 2025
  20. Karthik NayakJan 24, 2025
  21. Junio C HamanoJan 24, 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.