git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shejialuo <shejialuo@gmail.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, ps@pks.im
Subject: Re: [PATCH 2/5] refs/reftable: add fsck check for checking the table name
Date: Wed, 3 Sep 2025 21:39:32 +0800	[thread overview]
Message-ID: <aLhFFFKOo4CtVJJy@ArchLinux> (raw)
In-Reply-To: <CAOLa=ZR43JYu1ky_HF7nC4xkVe6B+fMWTNK+sczaar_8YNcd8A@mail.gmail.com>

On Mon, Sep 01, 2025 at 06:33:24AM -0700, Karthik Nayak wrote:
> shejialuo <shejialuo@gmail.com> writes:
> 
> > On Tue, Aug 19, 2025 at 02:21:01PM +0200, Karthik Nayak wrote:
> >> The `git refs verify` command is used to run fsck checks on the
> >> reference backends. This command is also invoked when users run 'git
> >> fsck'. While the files-backend has some fsck checks added, the reftable
> >> backend lacks such checks. Let's add the required infrastructure and a
> >> check to test for the table names in the 'tables.list' of reftables.
> >>
> >> For the infrastructure, since the reftable library is treated as an
> >> independent library we should ensure that the library code works
> >> independently without knowledge about Git's internals. To do this,
> >> add both 'reftable/fsck.c' and 'reftable/reftable-fsck.h'. Which
> >
> > A design question here, we name the "fsck.c" for the source code but for
> > the header, we use "reftable-fsck.h", it is a little strange. Why not
> > just "fsck.h" instead of "reftable-fsck.h".
> >
> 
> Since the reftable code is treated as an external library, all
> 'reftable-.*.h' headers are treated as headers which expose APIs for the
> libraries users. We would have defined 'reftable/fsck.h' if there were
> internal users of the 'fsck.c' code. But there are none.
> 

I understand the design. Thanks for the explanation.

[snip]

> >> +		uint32_t rnd;
> >> +		/*
> >> +		 * We want to match the tail '.ref'. One extra byte to ensure
> >> +		 * that there is no unexpected extra character and one byte for
> >> +		 * the null terminator added by sscanf.
> >> +		 */
> >> +		char tail[6];
> >> +
> >> +		if (sscanf(names[i], "0x%012" PRIx64 "-0x%012" PRIx64 "-%08x%5s",
> >> +			   &min, &max, &rnd, tail) != 4) {
> >> +			err = report_fn(info, cb_data);
> >
> > I think we could just pass pointer to avoid unnecessary copy operations.
> > Besides that, I think here we report two different kinds of problem. But
> > we would give report the user always the same message `invalid reftable
> > name`. This is too vague.
> >
> 
> Not sure what you mean by 'unnecessary copy operations', could you
> elaborate?
> 

In `report_fn`, we would copy the `info` value for each call. That's my
meaning.

Thanks,
Jialuo

  reply	other threads:[~2025-09-03 13:39 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19 12:20 [PATCH 0/5] refs/reftable: add fsck checks Karthik Nayak
2025-08-19 12:21 ` [PATCH 1/5] fsck: order 'fsck_msg_type' alphabetically Karthik Nayak
2025-08-19 12:21 ` [PATCH 2/5] refs/reftable: add fsck check for checking the table name Karthik Nayak
2025-08-26 16:21   ` shejialuo
2025-09-01 13:33     ` Karthik Nayak
2025-09-03 13:39       ` shejialuo [this message]
2025-08-19 12:21 ` [PATCH 3/5] refs/reftable: add fsck check for number of tables Karthik Nayak
2025-08-26 16:33   ` shejialuo
2025-09-01 13:40     ` Karthik Nayak
2025-08-26 16:44   ` shejialuo
2025-09-01 13:52     ` Karthik Nayak
2025-08-19 12:21 ` [PATCH 4/5] refs/reftable: add fsck check for trailing newline Karthik Nayak
2025-08-19 12:21 ` [PATCH 5/5] refs/reftable: add fsck check for incorrect update index Karthik Nayak
2025-08-26 16:39 ` [PATCH 0/5] refs/reftable: add fsck checks shejialuo
2025-09-01 13:52   ` Karthik Nayak
2025-09-02  7:05 ` [PATCH v2 " Karthik Nayak
2025-09-02  7:05   ` [PATCH v2 1/5] fsck: order 'fsck_msg_type' alphabetically Karthik Nayak
2025-09-02 22:25     ` Junio C Hamano
2025-09-08 13:00       ` Karthik Nayak
2025-09-02  7:05   ` [PATCH v2 2/5] refs/reftable: add fsck check for checking the table name Karthik Nayak
2025-09-03  8:07     ` Patrick Steinhardt
2025-09-03 16:51       ` shejialuo
2025-09-09 13:49         ` Karthik Nayak
2025-09-09  8:42       ` Karthik Nayak
2025-09-02  7:05   ` [PATCH v2 3/5] refs/reftable: add fsck check for number of tables Karthik Nayak
2025-09-03  8:07     ` Patrick Steinhardt
2025-09-15  9:27       ` Karthik Nayak
2025-09-02  7:05   ` [PATCH v2 4/5] refs/reftable: add fsck check for trailing newline Karthik Nayak
2025-09-02 22:38     ` Junio C Hamano
2025-09-03  8:07       ` Patrick Steinhardt
2025-09-02  7:05   ` [PATCH v2 5/5] refs/reftable: add fsck check for incorrect update index Karthik Nayak
2025-09-02 22:42     ` Junio C Hamano
2025-09-18  8:11       ` Karthik Nayak
2025-09-18  8:11 ` [PATCH v3 0/8] refs/reftable: add consistency checks Karthik Nayak
2025-09-18  8:11   ` [PATCH v3 1/8] refs: remove unused headers Karthik Nayak
2025-09-18  8:11   ` [PATCH v3 2/8] refs: move consistency check msg to generic layer Karthik Nayak
2025-09-18  8:11   ` [PATCH v3 3/8] reftable: check for trailing newline in 'tables.list' Karthik Nayak
2025-09-18 15:36     ` Junio C Hamano
2025-09-23 15:42       ` Karthik Nayak
2025-09-24  5:54     ` Patrick Steinhardt
2025-09-24 10:02       ` Karthik Nayak
2025-09-24  7:24     ` Kristoffer Haugsbakk
2025-09-24 11:06       ` Karthik Nayak
2025-09-18  8:11   ` [PATCH v3 4/8] reftable: ensure tables in a stack use sequential update indices Karthik Nayak
2025-09-24  5:54     ` Patrick Steinhardt
2025-09-24 11:20       ` Karthik Nayak
2025-09-24 18:04         ` Junio C Hamano
2025-09-24 20:13           ` Karthik Nayak
2025-09-25  6:12             ` Patrick Steinhardt
2025-09-25 16:22               ` Junio C Hamano
2025-09-18  8:11   ` [PATCH v3 5/8] Documentation/fsck-msgids: remove duplicate msg id Karthik Nayak
2025-09-18  8:11   ` [PATCH v3 6/8] fsck: order 'fsck_msg_type' alphabetically Karthik Nayak
2025-09-18  8:11   ` [PATCH v3 7/8] reftable: add code to facilitate consistency checks Karthik Nayak
2025-09-24  5:54     ` Patrick Steinhardt
2025-09-24 18:40       ` Karthik Nayak
2025-09-25  6:14         ` Patrick Steinhardt
2025-09-18  8:11   ` [PATCH v3 8/8] refs/reftable: add fsck check for checking the table name Karthik Nayak
2025-09-24  5:54     ` Patrick Steinhardt
2025-09-24 18:44       ` Karthik Nayak
2025-09-26  7:25 ` [PATCH v4 0/7] refs/reftable: add consistency checks Karthik Nayak
2025-09-26  7:25   ` [PATCH v4 1/7] refs: remove unused headers Karthik Nayak
2025-09-26  7:25   ` [PATCH v4 2/7] refs: move consistency check msg to generic layer Karthik Nayak
2025-09-26  7:25   ` [PATCH v4 3/7] reftable: check for trailing newline in 'tables.list' Karthik Nayak
2025-10-02 11:44     ` Patrick Steinhardt
2025-10-06 12:02       ` Karthik Nayak
2025-09-26  7:25   ` [PATCH v4 4/7] Documentation/fsck-msgids: remove duplicate msg id Karthik Nayak
2025-09-26  7:25   ` [PATCH v4 5/7] fsck: order 'fsck_msg_type' alphabetically Karthik Nayak
2025-09-26  7:25   ` [PATCH v4 6/7] reftable: add code to facilitate consistency checks Karthik Nayak
2025-10-02 11:44     ` Patrick Steinhardt
2025-09-26  7:25   ` [PATCH v4 7/7] refs/reftable: add fsck check for checking the table name Karthik Nayak
2025-10-02 11:44     ` Patrick Steinhardt
2025-10-06 12:05       ` Karthik Nayak
2025-09-26 21:08   ` [PATCH v4 0/7] refs/reftable: add consistency checks Junio C Hamano
2025-10-06 14:22 ` [PATCH v5 " Karthik Nayak
2025-10-06 14:22   ` [PATCH v5 1/7] refs: remove unused headers Karthik Nayak
2025-10-06 14:23   ` [PATCH v5 2/7] refs: move consistency check msg to generic layer Karthik Nayak
2025-10-06 14:23   ` [PATCH v5 3/7] reftable: check for trailing newline in 'tables.list' Karthik Nayak
2025-10-06 14:23   ` [PATCH v5 4/7] Documentation/fsck-msgids: remove duplicate msg id Karthik Nayak
2025-10-06 14:23   ` [PATCH v5 5/7] fsck: order 'fsck_msg_type' alphabetically Karthik Nayak
2025-10-06 14:23   ` [PATCH v5 6/7] reftable: add code to facilitate consistency checks Karthik Nayak
2025-10-06 14:23   ` [PATCH v5 7/7] refs/reftable: add fsck check for checking the table name Karthik Nayak
2025-10-07  2:32     ` Jeff King
2025-10-07  8:45       ` Karthik Nayak
2025-10-06 22:08   ` [PATCH v5 0/7] refs/reftable: add consistency checks Junio C Hamano
2025-10-07  8:47     ` Karthik Nayak
2025-10-07 15:11       ` Junio C Hamano
2025-10-07 12:11 ` [PATCH v6 " Karthik Nayak
2025-10-07 12:11   ` [PATCH v6 1/7] refs: remove unused headers Karthik Nayak
2025-10-07 12:11   ` [PATCH v6 2/7] refs: move consistency check msg to generic layer Karthik Nayak
2025-10-07 12:11   ` [PATCH v6 3/7] reftable: check for trailing newline in 'tables.list' Karthik Nayak
2025-10-07 12:11   ` [PATCH v6 4/7] Documentation/fsck-msgids: remove duplicate msg id Karthik Nayak
2025-10-07 12:11   ` [PATCH v6 5/7] fsck: order 'fsck_msg_type' alphabetically Karthik Nayak
2025-10-07 12:11   ` [PATCH v6 6/7] reftable: add code to facilitate consistency checks Karthik Nayak
2025-10-07 12:11   ` [PATCH v6 7/7] refs/reftable: add fsck check for checking the table name Karthik Nayak
2025-10-07 13:26   ` [PATCH v6 0/7] refs/reftable: add consistency checks Patrick Steinhardt
2025-10-07 16: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=aLhFFFKOo4CtVJJy@ArchLinux \
    --to=shejialuo@gmail.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).