git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v3 3/3] reftable: prevent 'update_index' changes after adding records
Date: Wed, 22 Jan 2025 13:12:53 +0100	[thread overview]
Message-ID: <Z5DgxQuc2j_-5GHg@pks.im> (raw)
In-Reply-To: <20250122-461-corrupted-reftable-followup-v3-3-ae5f88bf04fa@gmail.com>

On Wed, Jan 22, 2025 at 06:35:49AM +0100, Karthik Nayak wrote:
> diff --git a/t/unit-tests/t-reftable-stack.c b/t/unit-tests/t-reftable-stack.c
> index aeec195b2b1014445d71c5db39a9795017fd8ff2..c3f0059c346edbe1ad543c9832959c6fc0aa9180 100644
> --- a/t/unit-tests/t-reftable-stack.c
> +++ b/t/unit-tests/t-reftable-stack.c
> @@ -1369,11 +1371,57 @@ static void t_reftable_stack_reload_with_missing_table(void)
>  	clear_dir(dir);
>  }
>  
> +static int write_limits_after_ref(struct reftable_writer *wr, void *arg)
> +{
> +	struct reftable_ref_record *ref = arg;
> +	check(!reftable_writer_set_limits(wr, ref->update_index, ref->update_index));
> +	check(!reftable_writer_add_ref(wr, ref));
> +	return reftable_writer_set_limits(wr, ref->update_index, ref->update_index);
> +}

Nice.

> +static void t_reftable_invalid_limit_updates(void)
> +{
> +	struct reftable_ref_record ref = {
> +		.refname = (char *) "HEAD",
> +		.update_index = 1,
> +		.value_type = REFTABLE_REF_SYMREF,
> +		.value.symref = (char *) "master",
> +	};
> +	struct reftable_write_options opts = {
> +		.default_permissions = 0660,
> +	};

Nit: it's unnecessary to pass write options. Other than that the test
looks good to me, and this nit isn't worth a reroll.

Thanks for working on this!

Patrick

  reply	other threads:[~2025-01-22 12:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17  7:59 [PATCH 0/3] refs: small followups to the migration corruption fix Karthik Nayak
2025-01-17  7:59 ` [PATCH 1/3] refs: mark `ref_transaction_update_reflog()` as static Karthik Nayak
2025-01-17  9:29   ` Patrick Steinhardt
2025-01-20 11:17     ` Karthik Nayak
2025-01-17  7:59 ` [PATCH 2/3] refs: use 'uint64_t' for 'ref_update.index' Karthik Nayak
2025-01-17  7:59 ` [PATCH 3/3] reftable: prevent 'update_index' changes after header write Karthik Nayak
2025-01-17  9:29   ` Patrick Steinhardt
2025-01-20 11:47     ` Karthik Nayak
2025-01-20 12:18       ` Karthik Nayak
2025-01-21  3:34 ` [PATCH v2 0/3] refs: small followups to the migration corruption fix Karthik Nayak
2025-01-21  3:34   ` [PATCH v2 1/3] refs: mark `ref_transaction_update_reflog()` as static Karthik Nayak
2025-01-21  3:34   ` [PATCH v2 2/3] refs: use 'uint64_t' for 'ref_update.index' Karthik Nayak
2025-01-21  3:34   ` [PATCH v2 3/3] reftable: prevent 'update_index' changes after adding records Karthik Nayak
2025-01-21  6:56     ` Patrick Steinhardt
2025-01-21 11:44       ` Karthik Nayak
2025-01-22  5:35   ` [PATCH v3 0/3] refs: small followups to the migration corruption fix Karthik Nayak
2025-01-22  5:35     ` [PATCH v3 1/3] refs: mark `ref_transaction_update_reflog()` as static Karthik Nayak
2025-01-22  5:35     ` [PATCH v3 2/3] refs: use 'uint64_t' for 'ref_update.index' Karthik Nayak
2025-01-22  5:35     ` [PATCH v3 3/3] reftable: prevent 'update_index' changes after adding records Karthik Nayak
2025-01-22 12:12       ` Patrick Steinhardt [this message]
2025-01-22 17:50         ` Junio C Hamano
2025-01-22 21:57           ` Junio C Hamano
2025-02-01  2:24       ` undefined behavior in unit tests, was " Jeff King
2025-02-01 10:33         ` Phillip Wood
2025-02-03  5:41           ` Patrick Steinhardt
2025-02-03 14:11             ` Junio C Hamano
2025-02-03 15:37           ` Jeff King
2025-02-03  5:40         ` Patrick Steinhardt
2025-02-03 15:20         ` Karthik Nayak
2025-02-03 15:38           ` Jeff King

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=Z5DgxQuc2j_-5GHg@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    /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).