git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] contrib: Honor symbolic port in git-credential-netrc.

From
MCMaxim Cournoyer <maxim@guixotic.coop>
Date
Jun 21, 2025, 13:29 UTC
Message-ID
<87bjqhgr47.fsf@terra.mail-host-address-is-not-set>
In-Reply-To
<aFWwez5OEgLt0vRU@fruit.crustytoothpaste.net>
Hi,
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 14 quoted lines
> 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.

Show 8 quoted lines
> (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
Previous: brian m. carlsonNext: brian m. carlson
Message 9 of 31 in “contrib: Honor symbolic port in git-credential-netrc.”
  1. contrib: Honor symbolic port in git-credential-netrc.Maxim Cournoyer, Jun 20, 2025
  2. Junio C HamanoJun 20, 2025
  3. Andreas SchwabJun 20, 2025
  4. Junio C HamanoJun 20, 2025
  5. Maxim CournoyerJun 21, 2025
  6. Maxim CournoyerJun 23, 2025
  7. Maxim CournoyerJun 23, 2025
  8. brian m. carlsonJun 20, 2025
  9. Maxim CournoyerJun 21, 2025
  10. brian m. carlsonJun 21, 2025
  11. 1/3 contrib: use a more portable shebang for git-credential-netrcMaxim Cournoyer, Jun 22, 2025
  12. 0/3 git-credential-netrc: better symbolic port names supportMaxim Cournoyer, Jun 22, 2025
  13. 3/3 contrib: better support symbolic port names in git-credential-netrcMaxim Cournoyer, Jun 22, 2025
  14. Junio C HamanoJun 23, 2025
  15. Maxim CournoyerJun 24, 2025
  16. 2/3 contrib: warn for invalid netrc file ports in git-credential-netrcMaxim Cournoyer, Jun 22, 2025
  17. 1/3 contrib: use a more portable shebang for git-credential-netrcMaxim Cournoyer, Jun 24, 2025
  18. 0/3 git-credential-netrc: better symbolic port names supportMaxim Cournoyer, Jun 24, 2025
  19. Junio C HamanoJun 24, 2025
  20. Maxim CournoyerJun 24, 2025
  21. Junio C HamanoJun 25, 2025
  22. Maxim CournoyerJun 25, 2025
  23. 0/3 git-credential-netrc: better symbolic port names supportMaxim Cournoyer, Jun 25, 2025
  24. 2/3 contrib: warn for invalid netrc file ports in git-credential-netrcMaxim Cournoyer, Jun 25, 2025
  25. 3/3 contrib: better support symbolic port names in git-credential-netrcMaxim Cournoyer, Jun 25, 2025
  26. 1/3 contrib: use a more portable shebang for git-credential-netrcMaxim Cournoyer, Jun 25, 2025
  27. Junio C HamanoJun 25, 2025
  28. Maxim CournoyerJun 26, 2025
  29. 3/3 contrib: better support symbolic port names in git-credential-netrcMaxim Cournoyer, Jun 24, 2025
  30. Junio C HamanoJun 24, 2025
  31. 2/3 contrib: warn for invalid netrc file ports in git-credential-netrcMaxim Cournoyer, Jun 24, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.