git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Jeff King <peff@peff.net>
Cc: Piotr Szlazak via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>,
	David Turner <dturner@twosigma.com>,
	Piotr Szlazak <piotr.szlazak@gmail.com>
Subject: Re: [PATCH] upload-pack: fix how ALLOW_ANY_SHA1 flag is disabled
Date: Thu, 17 Oct 2024 11:23:15 -0400	[thread overview]
Message-ID: <ZxEr4+sb4DfmtrKv@nand.local> (raw)
In-Reply-To: <20241017023735.GB1858436@coredump.intra.peff.net>

On Wed, Oct 16, 2024 at 10:37:35PM -0400, Jeff King wrote:
> > I think it would probably make more sense to write this as:
> >
> >     data->allow_uor &= ~(ALLOW_ANY_SHA1 ^ (ALLOW_TIP_SHA1 | ALLOW_REACHABLE_SHA1));
>
> I think we have to treat them as a complete unit, as we don't know which
> bits were set by independent config lines and which were OR-ed in by
> ALLOW_ANY.
>
> So this case:
>
> > Stepping back a moment, I suppose this is handling the case where a user
> > writes:
> >
> >     [uploadpack]
> >         allowTipSHA1InWant = true
> >         allowReachableSHA1InWant = true
> >         allowAnySHA1InWant = false
> >
> > and is surprised when the final "uploadPack.allowAnySHA1InWant" unsets
> > the previous two options.

Yeah, I think that you and I are in agreement here.

> is the one that Piotr is thinking about. But what about:
>
>   [uploadpack]
>   allowAnySHA1InWant = true
>   allowAnySHA1InWant = false
>
> Right now that pair is a noop, which is what I'd expect. But after the
> proposed patch, it quietly enables ALLOW_TIP_SHA1 and
> ALLOW_REACHABLE_SHA1.

That's an even clearer example of a new gotcha that would occur with
this proposed patch, IMHO. I don't think in general that successive

    $ git config core.foo true
    $ git config core.foo false

should have any user-visible effect, as the latter should nullify the
former.

> So I think the code has to stay the same, but we perhaps should document
> that "allow any" has the user-visible side effect of enabling/disabling
> the other two.

That would be a useful direction, I think. Double checking
git-config(1), there is in deed no mention of allowAnySHA1InWant
implying the other two options, which seems like a gap that would be
good to address.

Piotr: what do you think?

Thanks,
Taylor

  reply	other threads:[~2024-10-17 15:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 21:06 [PATCH] upload-pack: fix how ALLOW_ANY_SHA1 flag is disabled Piotr Szlazak via GitGitGadget
2024-10-16 21:18 ` Taylor Blau
2024-10-17  2:37   ` Jeff King
2024-10-17 15:23     ` Taylor Blau [this message]
2024-10-17 15:59       ` Piotr Szlazak
2024-10-17 18:46         ` Taylor Blau
2024-10-18  4:33           ` Jeff King
2024-10-18 21:46             ` Taylor Blau
2024-10-19 16:39 ` [PATCH v2] doc: document how uploadpack.allowAnySHA1InWant impact other allow options Piotr Szlazak via GitGitGadget
2024-10-19 16:46   ` Piotr Szlazak
2024-10-21  5:55     ` Piotr Szlazak
2024-10-21 19:03       ` Jeff King
2024-10-21 19:47         ` Taylor Blau
2024-10-21 19:48   ` Taylor Blau

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=ZxEr4+sb4DfmtrKv@nand.local \
    --to=me@ttaylorr.com \
    --cc=chriscool@tuxfamily.org \
    --cc=dturner@twosigma.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=peff@peff.net \
    --cc=piotr.szlazak@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).