git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim@guixotic.coop>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Maxim Cournoyer <maxim@guixotic.coop>,  git@vger.kernel.org
Subject: Re: [PATCH] contrib: Honor symbolic port in git-credential-netrc.
Date: Sat, 21 Jun 2025 22:29:28 +0900	[thread overview]
Message-ID: <87bjqhgr47.fsf@terra.mail-host-address-is-not-set> (raw)
In-Reply-To: <aFWwez5OEgLt0vRU@fruit.crustytoothpaste.net> (brian m. carlson's message of "Fri, 20 Jun 2025 19:03:23 +0000")

Hi,

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> On 2025-06-20 at 04:12:39, Maxim Cournoyer wrote:
>> Symbolic ports were previously silently dropped, which made it
>> impossible to use them with git-credential-netrc. This is a supported
>> use case according to 'man git-send-email', for --smtp-server-port:
>> 
>>    [...] symbolic port names (e.g. "submission" instead of 587) are
>>    also accepted.
>
> Does this work with credential managers in general (that is, in
> non-email contexts, such as HTTP)?  Also, do credential managers in
> general properly find credentials when they're stored in one form and
> looked up in another?  If so, is that still true when the lookup is in
> the URL form (e.g., `smtp://mail.example.com:587/`)?  Is this documented
> to work in the credential manual page?

I'm quite new to the credential-manager of git, so I do not have an
answer to these excellent questions.  But, as some perhaps useful
datapoint, at least using Emacs's auth-source library with a
~/.authinfo.gpg file (which is in the netrc format), if you use a
symbolic port name, you have to use it everywhere if you want
auth-source to match it correctly (it doesn't translate smtps to 465 for
example). If you put 'port smtps' in the .authinfo.gpg but specify the
SMTP port in the your Emacs MTA to a integer like 465, it won't match.

This could be considered a bug in auth-source.el, and git
credential-manager can do better by converting all port input values to
their integer form, as you suggested.  Then mismatched configurations
(e.g.: smtps in netrc and sendemail.smtpServerPort = 465 or vice-versa)
would be handled correctly.

> (To be clear, I would be very
> surprised if the answer to any of these were "yes" because I've
> literally never seen this usage before with Git, but I am open to
> updating my knowledge if that's the case.)
>
> If not, then I think the proper thing to do is to have `git send-email`
> rewrite the name into a port instead of having the netrc credential
> helper learn to handle non-numeric ports.

Did I understand correctly with my suggestion/rewording of yours above?
git-credential-netrc reads its input from the netrc file, which may well
have a symbolic port, so it should itself convert from symbolic to
actual port numbers, IIUC.

-- 
Thanks,
Maxim


  reply	other threads:[~2025-06-21 13:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20  4:12 [PATCH] contrib: Honor symbolic port in git-credential-netrc Maxim Cournoyer
2025-06-20 13:48 ` Junio C Hamano
2025-06-20 14:22   ` Andreas Schwab
2025-06-20 16:39     ` Junio C Hamano
2025-06-21 13:57     ` Maxim Cournoyer
2025-06-23  3:28   ` Maxim Cournoyer
2025-06-23  3:34   ` Maxim Cournoyer
2025-06-20 19:03 ` brian m. carlson
2025-06-21 13:29   ` Maxim Cournoyer [this message]
2025-06-21 15:52     ` brian m. carlson
2025-06-22 15:25 ` [PATCH v2 0/3] git-credential-netrc: better symbolic port names support Maxim Cournoyer
2025-06-22 15:25 ` [PATCH v2 1/3] contrib: use a more portable shebang for git-credential-netrc Maxim Cournoyer
2025-06-22 15:25 ` [PATCH v2 2/3] contrib: warn for invalid netrc file ports in git-credential-netrc Maxim Cournoyer
2025-06-22 15:25 ` [PATCH v2 3/3] contrib: better support symbolic port names " Maxim Cournoyer
2025-06-23 18:03   ` Junio C Hamano
2025-06-24  1:51     ` Maxim Cournoyer
2025-06-24  1:48 ` [PATCH v3 0/3] git-credential-netrc: better symbolic port names support Maxim Cournoyer
2025-06-24 16:04   ` Junio C Hamano
2025-06-24 23:55     ` Maxim Cournoyer
2025-06-25  0:24       ` Junio C Hamano
2025-06-25  1:03         ` Maxim Cournoyer
2025-06-25 14:25           ` [PATCH v4 " Maxim Cournoyer
2025-06-25 14:25             ` [PATCH v4 1/3] contrib: use a more portable shebang for git-credential-netrc Maxim Cournoyer
2025-06-25 14:25             ` [PATCH v4 2/3] contrib: warn for invalid netrc file ports in git-credential-netrc Maxim Cournoyer
2025-06-25 14:25             ` [PATCH v4 3/3] contrib: better support symbolic port names " Maxim Cournoyer
2025-06-25 16:49             ` [PATCH v4 0/3] git-credential-netrc: better symbolic port names support Junio C Hamano
2025-06-26  1:15               ` Maxim Cournoyer
2025-06-24  1:48 ` [PATCH v3 1/3] contrib: use a more portable shebang for git-credential-netrc Maxim Cournoyer
2025-06-24  1:48 ` [PATCH v3 2/3] contrib: warn for invalid netrc file ports in git-credential-netrc Maxim Cournoyer
2025-06-24  1:48 ` [PATCH v3 3/3] contrib: better support symbolic port names " Maxim Cournoyer
2025-06-24 16:06   ` 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=87bjqhgr47.fsf@terra.mail-host-address-is-not-set \
    --to=maxim@guixotic.coop \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.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).