git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Xavier Morel <xavier.morel@masklinn.net>, git@vger.kernel.org
Subject: Re: [PATCH 0/3] actually detect bad file modes in fsck
Date: Thu, 11 Aug 2022 11:39:42 +0200	[thread overview]
Message-ID: <220811.86r11nqfi2.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <YvQcNpizy9uOZiAz@coredump.intra.peff.net>


On Wed, Aug 10 2022, Jeff King wrote:

> On Wed, Aug 10, 2022 at 04:04:17PM -0400, Jeff King wrote:
>
>> > Maybe downgrade to info or ignore by default then? It might still be
>> > an issue for people who wilfully upgraded the diagnostic to error
>> > hoping to catch the, but hopefully if they did that they'd rather get
>> > the notice later than never?
>> 
>> Yeah, that may be a sensible resolution. All things being equal I think
>> "warning" is the right level, but out of caution and the historical
>> precedent, maybe downgrading it to "info" is justified.
>> 
>> It should be easy to work that into the patch I showed earlier.
>
> OK, so here are cleaned-up patches to do that.
>
>   [1/3]: tree-walk: add a mechanism for getting non-canonicalized modes
>   [2/3]: fsck: actually detect bad file modes in trees
>   [3/3]: fsck: downgrade tree badFilemode to "info"

This LGTM.

I noticed/reported this issue more than a year ago, but the series I had
for fixing it ended up being dropped, here's the report/analysis at the
time:
https://lore.kernel.org/git/20210308150650.18626-31-avarab@gmail.com/

Basically I was taking a much longer way around to avoid...

>  	/* counts the number of bytes left in the `buffer`. */
>  	unsigned int size;
> +
> +	/* option flags passed via init_tree_desc_gently() */
> +	enum tree_desc_flags {
> +		TREE_DESC_RAW_MODES = (1 << 0),
> +	} flags;
>  };

...this from 1/3 here, i.e. now we're paying the cost of an extra entry
in every "struct tree_desc" user (which includes some hot codepaths),
and just for this one fsck caller.

I wonder if we couldn't introduce a init_tree_desc_gently_flags() for
this instead. You note in 1/3 that you're (rightly) avoiding the churn
of existing callers, but they could just use a "static inline" wrapper
function that would set those flags to 0, we'd pass the flags down, and
not put them into the "tree_desc" struct.

Arguably it doesn't belong there at all, since this new thing is really
an "opts" struct, but "tree_desc" is for "the state of the walk".

It might/would make sense as a "raw_mode" in "struct name_entry"
perhaps, but then we're gettin closer to the larger scope of my initial
larger series, oh well ... :)


  parent reply	other threads:[~2022-08-11  9:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-06 13:43 fsck: BAD_FILEMODE diagnostic broken / never triggers Xavier Morel
2022-08-09 22:48 ` Jeff King
2022-08-09 23:28   ` Jeff King
2022-08-10 15:01     ` Xavier Morel
2022-08-10 20:04       ` Jeff King
2022-08-10 20:59         ` [PATCH 0/3] actually detect bad file modes in fsck Jeff King
2022-08-10 21:01           ` [PATCH 1/3] tree-walk: add a mechanism for getting non-canonicalized modes Jeff King
2022-08-10 21:02           ` [PATCH 2/3] fsck: actually detect bad file modes in trees Jeff King
2022-08-10 21:35             ` Junio C Hamano
2022-08-10 21:46               ` Jeff King
2022-08-10 21:54                 ` Junio C Hamano
2022-08-10 21:04           ` [PATCH 3/3] fsck: downgrade tree badFilemode to "info" Jeff King
2022-08-10 22:08             ` Junio C Hamano
2022-08-11  8:33               ` Jeff King
2022-08-11 16:24                 ` Junio C Hamano
2022-08-11  9:39           ` Ævar Arnfjörð Bjarmason [this message]
2022-08-14  7:03             ` [PATCH 0/3] actually detect bad file modes in fsck 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=220811.86r11nqfi2.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=xavier.morel@masklinn.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).