git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org,  ps@pks.im,  sandals@crustytoothpaste.net,
	Johannes.Schindelin@gmx.de
Subject: Re: [PATCH v2] reftable: write correct max_update_index to header
Date: Thu, 23 Jan 2025 10:24:49 -0800	[thread overview]
Message-ID: <xmqq5xm5s80e.fsf@gitster.g> (raw)
In-Reply-To: <xmqqbjvxs8me.fsf@gitster.g> (Junio C. Hamano's message of "Thu, 23 Jan 2025 10:11:37 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> 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


  reply	other threads:[~2025-01-23 18:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 13:56 Bug in 2.48 with `git refs migrate` brian m. carlson
2025-01-13 15:45 ` Patrick Steinhardt
2025-01-15 11:54 ` Karthik Nayak
2025-01-15 17:07   ` Junio C Hamano
2025-01-16  6:44     ` Karthik Nayak
2025-01-16  2:05   ` brian m. carlson
2025-01-16  7:29     ` Karthik Nayak
2025-01-16 23:21   ` brian m. carlson
2025-01-17  0:04     ` Junio C Hamano
2025-01-17  6:17       ` Karthik Nayak
2025-01-17  6:15     ` Karthik Nayak
2025-01-23 13:56   ` [PATCH v2] reftable: write correct max_update_index to header Karthik Nayak
2025-01-23 18:11     ` Junio C Hamano
2025-01-23 18:24       ` Junio C Hamano [this message]
2025-01-24 14:02         ` [PATCH v3] refs: fix uninitialized memory access of `max_index` Karthik Nayak
2025-01-24 14:46           ` Patrick Steinhardt
2025-01-24 15:48             ` Karthik Nayak
2025-01-27 10:20               ` Patrick Steinhardt
2025-01-27 16:24                 ` Junio C Hamano
2025-01-24  4:06       ` [PATCH v2] reftable: write correct max_update_index to header Karthik Nayak
2025-01-24 15:25         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq5xm5s80e.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=ps@pks.im \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).