From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, ps@pks.im
Subject: Re: [PATCH v2] reftable/writer: ensure valid range for log's update_index
Date: Sat, 07 Dec 2024 08:11:36 +0900 [thread overview]
Message-ID: <xmqqwmgcv23b.fsf@gitster.g> (raw)
In-Reply-To: <20241206-424-reftable-writer-add-check-for-limits-v2-1-82ca350b10be@gmail.com> (Karthik Nayak's message of "Fri, 06 Dec 2024 14:13:19 +0100")
Karthik Nayak <karthik.188@gmail.com> writes:
> The corresponding check for reflogs in `reftable_writer_add_log` is
> however missing. Add a similar check, but only check for the upper
> limit. This is because reflogs are treated a bit differently than refs.
> Each reflog entry in reftable has an associated update_index and we also
> allow expiring entries in the middle, which is done by simply writing a
> new reflog entry with the same update_index. This means, writing reflog
> entries with update_index lesser than the writer's update_index is an
> expected scenario.
>
> Add a new unit test to check for the limits and fix some of the existing
> tests, which were setting arbitrary values for the update_index by
> ensuring they stay within the now checked limits.
Interesting. I am a little curious how this was found. As long as
the other parts of the system (i.e. the callers) are not buggy, the
update pointer will stay within the range, and that is why I do not
think I can write an end-to-end test to trigger an existing bug that
would be caught by this "fix". Fixing the existing unit tests that
feed a wrong input and expect some right outcome is good, but would
it be a good to also have a new unit test that validates that such
an incorrect precondition for calling is caught and the caller gets
the expected REFTABLE_API_ERROR as a result, I wonder? Being able
to trigger a condition that is harder to do with the end-to-end test
is one good thing about having unit test framework, no?
Will queue. Thanks.
next prev parent reply other threads:[~2024-12-06 23:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 15:49 [PATCH] reftable/writer: ensure valid range for log's update_index Karthik Nayak
2024-12-06 9:06 ` Patrick Steinhardt
2024-12-06 11:24 ` karthik nayak
2024-12-06 13:13 ` [PATCH v2] " Karthik Nayak
2024-12-06 23:11 ` Junio C Hamano [this message]
2024-12-07 9:54 ` karthik nayak
2024-12-11 13:10 ` Toon Claes
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=xmqqwmgcv23b.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
/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).