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: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] branch: do not fail a no-op --edit-desc
Date: Fri, 30 Sep 2022 19:58:03 +0200	[thread overview]
Message-ID: <220930.861qrsvj12.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqq7d1klrua.fsf@gitster.g>


On Fri, Sep 30 2022, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>>> The end result is OK in that the configuration variable does not
>>> exist in the resulting repository, but we should do better, by using
>>> git_config_set_gently() and ignoring only the specific error that is
>>> returned when removing a missing configuration variable.
>> ...
>> I was curious to follow up on your suggestion in your 3rd paragraph, so
>> I tried implementing this in the config API, results below, if you're
>> interested in it assume my SOB.
>
> Did I make any suggestion?  I am assuming that what I left in the
> quote above is the paragraph you are referring to, and that is not a
> suggestion but a description of what the patch did, so I am puzzled.

I think I just misread "by using git_config_set_gently() and ignoring
only the specific error that is returned when removing a missing
configuration variable." as "an alternative of this might do this via
the config API"...

>> But, having done that I discovered that your code here has a bug,
>> admittedly a pretty obscure one. The CONFIG_NOTHING_SET flag on "set"
>> doesn't mean "nothing to set, because it's there already", it means
>> "either <that>, or the key is multi-value and I'm bailing out".
>
> Ah, OK, so in short, _gently() is still unusable to use for that.  I
> guess it means that the approach taken by v1 would be a better
> solution, then.

As you noted it's got a TOCTOU instead, so we might wipe away good
config entirely.

I think between the two I'd go with v2, bugs and all, it's pretty
unlikely that someone has two "description" entries.


  reply	other threads:[~2022-09-30 18:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 19:15 [PATCH] branch: do not fail a no-op --edit-desc Junio C Hamano
2022-09-28 23:04 ` Rubén Justo
2022-09-28 23:40   ` Junio C Hamano
2022-09-29 21:49 ` Rubén Justo
2022-09-29 22:26   ` Junio C Hamano
2022-09-30 22:59     ` Rubén Justo
2022-10-01  9:15     ` Rubén Justo
2022-09-30  1:27 ` [PATCH v2] " Junio C Hamano
2022-09-30 10:21   ` Ævar Arnfjörð Bjarmason
2022-09-30 17:01     ` Junio C Hamano
2022-09-30 17:58       ` Ævar Arnfjörð Bjarmason [this message]
2022-09-30 18:13         ` Junio C Hamano
2022-09-30 18:06   ` [PATCH v3] " 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

  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=220930.861qrsvj12.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).