git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	git@vger.kernel.org, "Jiang Xin" <worldhello.net@gmail.com>,
	"Bernhard Reiter" <ockham@raz.or.at>,
	"Remi Pommarel" <repk@triplefau.lt>
Subject: Re: [PATCH v2 6/6] imap-send: correctly report "host" when using "tunnel"
Date: Mon, 06 Feb 2023 13:41:56 -0800	[thread overview]
Message-ID: <xmqq1qn25v4r.fsf@gitster.g> (raw)
In-Reply-To: <Y94866yd3adoC1o9@coredump.intra.peff.net> (Jeff King's message of "Sat, 4 Feb 2023 06:09:31 -0500")

Jeff King <peff@peff.net> writes:

> Yes, I agree that the scenario I'm giving is contrary to what the docs
> say. But IMHO it is worth preferring what the code does now versus what
> the docs say. The current behavior misbehaves if you configure things
> badly (accidentally mix and match imap.host and imap.tunnel). Your new
> behavior misbehaves if you have two correctly-configure imap stanzas
> (both with a host/tunnel combo). Those are both fairly unlikely
> scenarios, and the outcomes are similar (we mix up credentials), but:
>
>   1. In general, all things being equal, I'd rather trust the code as
>      the status quo. People will complain if you break their working
>      setup. They won't if you fix the documentation.
>
>   2. In the current behavior, if it's doing the wrong thing, your next
>      step is to fix your configuration (don't mix and match imap.host
>      and imap.tunnel). In your proposed behavior, there is no fix. You
>      are simply not allowed to use two different imap tunnels with
>      credential helpers, because the helpers don't receive enough
>      context to distinguish them.
>
>      And that is not even "two imap tunnels in the same config". It is
>      really per user. If I have two repositories, each with
>      "imap.tunnel" in their local config, they will still invoke the
>      same credential helpers, and both will just see host=tunnel. The
>      namespace for "host" really is global and should be unique (ideally
>      across the Internet, but at the very least among the hosts that the
>      user contacts).

All good points.

> Yes, there are many config schemes that would avoid this problem. If you
> are going to tie the two together, I think it would make sense to use
> real subsections based on the host-name, like:
>
>   # hostname is the subsection key; it also becomes a label when
>   # necessary
>   [imap "example.com"]
>
>   # does not even need to mention a hostname. We'll assume example.com
>   # here.
>   tunnel = "any-command"
>
>   # assumes example.com as hostname; not needed if you are using a
>   # tunnel, of course
>   protocol = imaps
>
> But I would not bother going to that work myself. IMHO imap-send is
> somewhat of an abomination, and I'd actually be just as happy if it went
> away. But what you are doing seems to go totally in the wrong direction
> to me (keeping it, but breaking a rare but working use case to the
> benefit of a rare but broken misconfiguration).

Yup.

  parent reply	other threads:[~2023-02-06 21:42 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 11:31 [PATCH 1/2] Makefile: not use mismatched curl_config to check version Jiang Xin
2023-02-01 11:31 ` [PATCH 2/2] imap-send: not define USE_CURL_FOR_IMAP_SEND in Makefile Jiang Xin
2023-02-01 23:04   ` [PATCH] imap-send: replace auto-probe libcurl with hard dependency Ævar Arnfjörð Bjarmason
2023-02-01 23:22     ` Junio C Hamano
2023-02-01 23:56       ` Ævar Arnfjörð Bjarmason
2023-02-02  1:32         ` Junio C Hamano
2023-02-01 23:59       ` Jeff King
2023-02-02  0:20         ` Ævar Arnfjörð Bjarmason
2023-02-02  9:44     ` [PATCH v2 0/6] " Ævar Arnfjörð Bjarmason
2023-02-02  9:44       ` [PATCH v2 1/6] imap-send: note "auth_method", not "host" on auth method failure Ævar Arnfjörð Bjarmason
2023-02-02 19:11         ` Junio C Hamano
2023-02-02  9:44       ` [PATCH v2 2/6] imap-send doc: the imap.sslVerify is used with imap.tunnel Ævar Arnfjörð Bjarmason
2023-02-02  9:44       ` [PATCH v2 3/6] imap-send: replace auto-probe libcurl with hard dependency Ævar Arnfjörð Bjarmason
2023-02-02 19:33         ` Junio C Hamano
2023-02-02  9:44       ` [PATCH v2 4/6] imap-send: make --curl no-optional Ævar Arnfjörð Bjarmason
2023-02-02 20:42         ` Junio C Hamano
2023-02-03 21:46           ` Ævar Arnfjörð Bjarmason
2023-02-04  5:22             ` Junio C Hamano
2023-02-02  9:44       ` [PATCH v2 5/6] imap-send: remove old --no-curl codepath Ævar Arnfjörð Bjarmason
2023-02-02 20:43         ` Junio C Hamano
2023-02-02  9:44       ` [PATCH v2 6/6] imap-send: correctly report "host" when using "tunnel" Ævar Arnfjörð Bjarmason
2023-02-02 20:56         ` Junio C Hamano
2023-02-03 17:53         ` Jeff King
2023-02-03 21:12           ` Ævar Arnfjörð Bjarmason
2023-02-04 11:09             ` Jeff King
2023-02-05 21:51               ` Ævar Arnfjörð Bjarmason
2023-02-07 18:30                 ` Jeff King
2023-02-07 20:39                   ` Ævar Arnfjörð Bjarmason
2023-02-07 21:26                     ` Junio C Hamano
2023-02-07 22:04                       ` Ævar Arnfjörð Bjarmason
2023-02-07 22:16                       ` Jeff King
2023-02-07 22:15                     ` Jeff King
2023-02-07 22:24                       ` Junio C Hamano
2023-02-08  1:06                       ` Ævar Arnfjörð Bjarmason
2023-02-17 20:50                         ` Jeff King
2023-02-06 21:41               ` Junio C Hamano [this message]
2023-02-01 18:06 ` [PATCH 1/2] Makefile: not use mismatched curl_config to check version 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=xmqq1qn25v4r.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ockham@raz.or.at \
    --cc=peff@peff.net \
    --cc=repk@triplefau.lt \
    --cc=worldhello.net@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).