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

Re: [PATCH] git-send-email: add ~/.authinfo parsing

From
Ted Zlatanov <tzz@lifelogs.com>
Date
Jan 30, 2013, 15:03 UTC
Message-ID
<87vcae90hr.fsf@lifelogs.com>
In-Reply-To
<7vvcafojf4.fsf@alter.siamese.dyndns.org>
On Tue, 29 Jan 2013 11:53:19 -0800 Junio C Hamano <gitster@pobox.com> wrote: 
JCH> Makes one wonder why .authinfo and not .netrc; 
JCH> http://www.gnu.org/software/emacs/manual/html_node/auth/Help-for-users.html
JCH> phrases it amusingly:

JCH> “Netrc” files are usually called .authinfo or .netr JCH> nowadays .authinfo seems to be more popular and the JCH> auth-source library encourages this confusion by accepting JCH> both

I wrote this and the auth-source.el library in Emacs (I'm glad it was amusing :). The confusion is further perpetuated by our (in Emacs) encouragement to use a .authinfo.gpg file, which is then decrypted on the fly by Emacs through GPG. The format is the same; by the time auth-source.el sees the contents, they are plain text since the decoding happens at the file handler level.

I think it makes sense to write the code to support both `git-send-email' and credentials. I have had it in my TODO list for almost 2 years now to work on credential support, and to support the ~/.authinfo.gpg decoding specifically. Ideally this would also support the other formats... Michal, would you be interested in that feature? I promise to get off my rear and help out.

Show 6 quoted lines
>> +The '~/.authinfo' file is read if Text::CSV Perl module is installed
>> +on the system; if it's missing, a notification message will be printed
>> +and the file ignored altogether.  The file should contain a line with
>> +the following format:
>> ++
>> +  machine <domain> port <port> login <user> password <pass>

JCH> It is rather strange to require a comma-separated-values parser to JCH> read a file format this simple, isn't it?

I'd recommend a hand-crafted parser. Among other things, you should accept both "strings" and 'strings' if possible (I've seen both formats in the wild), and the format is simple enough to avoid the module dependency.

>> ++
>> +Contrary to other tools, 'git-send-email' does not support symbolic
>> +port names like 'imap' thus `<port>` must be a number.

JCH> Perhaps you can convert at least some popular ones yourself? After JCH> all, the user may be using an _existing_ .authinfo/.netrc that she JCH> has been using with other programs that do understand symbolic port JCH> names. Rather than forcing all such users to update their files, JCH> the patch can work a bit harder for them and the world will be a JCH> better place, no?

I agree, "port imap" is a nice self-documenting token. Maybe it can be interpreted by the program that requests the token with a services lookup, where supported.

Ted
Previous: Ted Zlatanov
Message 78 of 78 in “git-send-email: add ~/.authinfo parsing”
  1. git-send-email: add ~/.authinfo parsingMichal Nazarewicz, Jan 29, 2013
  2. Junio C HamanoJan 29, 2013
  3. [PATCHv2] git-send-email: add ~/.authinfo parsingMichal Nazarewicz, Jan 29, 2013
  4. Junio C HamanoJan 29, 2013
  5. [PATCHv3] git-send-email: add ~/.authinfo parsingMichal Nazarewicz, Jan 30, 2013
  6. Junio C HamanoJan 30, 2013
  7. Jeff KingJan 30, 2013
  8. Junio C HamanoJan 30, 2013
  9. Ted ZlatanovJan 31, 2013
  10. Jeff KingJan 31, 2013
  11. Ted ZlatanovFeb 2, 2013
  12. Jeff KingFeb 3, 2013
  13. Ted ZlatanovFeb 4, 2013
  14. 1/3 Add contrib/credentials/netrc with GPG supportTed Zlatanov, Feb 4, 2013
  15. Ted ZlatanovFeb 4, 2013
  16. Junio C HamanoFeb 4, 2013
  17. Ted ZlatanovFeb 4, 2013
  18. Junio C HamanoFeb 4, 2013
  19. Ted ZlatanovFeb 4, 2013
  20. Junio C HamanoFeb 4, 2013
  21. CodingGuidelines Perl amendment (was: [PATCH 1/3] Add contrib/credentials/netrc with GPG support)Ted Zlatanov, Feb 6, 2013
  22. Junio C HamanoFeb 6, 2013
  23. demerphqFeb 6, 2013
  24. Ted ZlatanovFeb 6, 2013
  25. Junio C HamanoFeb 6, 2013
  26. demerphqFeb 6, 2013
  27. Update CodingGuidelines for Perl 5Ted Zlatanov, Feb 6, 2013
  28. Ted ZlatanovFeb 6, 2013
  29. Junio C HamanoFeb 6, 2013
  30. Ted ZlatanovFeb 6, 2013
  31. demerphqFeb 6, 2013
  32. Ted ZlatanovFeb 6, 2013
  33. demerphqFeb 6, 2013
  34. Ted ZlatanovFeb 6, 2013
  35. Junio C HamanoFeb 6, 2013
  36. Update CodingGuidelines for Perl 5Ted Zlatanov, Feb 6, 2013
  37. 2/3 Skip blank and commented lines in contrib/credentials/netrcTed Zlatanov, Feb 4, 2013
  38. 3/3 Fix contrib/credentials/netrc minor issues: exit quietly; use 3-parameter open; etc.Ted Zlatanov, Feb 4, 2013
  39. Junio C HamanoFeb 4, 2013
  40. Ted ZlatanovFeb 4, 2013
  41. Michal NazarewiczFeb 4, 2013
  42. Ted ZlatanovFeb 4, 2013
  43. Jeff KingFeb 4, 2013
  44. Ted ZlatanovFeb 4, 2013
  45. Jeff KingFeb 4, 2013
  46. Ted ZlatanovFeb 4, 2013
  47. Jeff KingFeb 4, 2013
  48. Ted ZlatanovFeb 4, 2013
  49. Junio C HamanoFeb 5, 2013
  50. Matthieu MoyFeb 6, 2013
  51. Ted ZlatanovFeb 6, 2013
  52. Matthieu MoyFeb 6, 2013
  53. Ted ZlatanovFeb 6, 2013
  54. Matthieu MoyFeb 6, 2013
  55. Ted ZlatanovFeb 6, 2013
  56. 0/4 Allow contrib/ to use Git's Makefile for perl codeMatthieu Moy, Feb 6, 2013
  57. 1/4 Makefile: extract perl-related rules to make them available from other dirsMatthieu Moy, Feb 6, 2013
  58. Junio C HamanoFeb 7, 2013
  59. 2/4 perl.mak: introduce $(GIT_ROOT_DIR) to allow inclusion from other directoriesMatthieu Moy, Feb 6, 2013
  60. 3/4 Makefile: factor common configuration in git-default-config.makMatthieu Moy, Feb 6, 2013
  61. Junio C HamanoFeb 7, 2013
  62. Matthieu MoyFeb 8, 2013
  63. 1/2 Makefile: make script-related rules usable from subdirectoriesMatthieu Moy, Feb 8, 2013
  64. 2/2 git-remote-mediawiki: use toplevel's MakefileMatthieu Moy, Feb 8, 2013
  65. 4/4 git-remote-mediawiki: use Git's Makefile to build the scriptMatthieu Moy, Feb 6, 2013
  66. Junio C HamanoFeb 7, 2013
  67. Jeff KingFeb 8, 2013
  68. Matthieu MoyFeb 8, 2013
  69. Jeff KingFeb 8, 2013
  70. Junio C HamanoFeb 8, 2013
  71. Jeff KingFeb 8, 2013
  72. Jeff KingFeb 6, 2013
  73. Ted ZlatanovFeb 6, 2013
  74. Matthieu MoyFeb 7, 2013
  75. Ted ZlatanovFeb 7, 2013
  76. Michal NazarewiczFeb 6, 2013
  77. Ted ZlatanovFeb 6, 2013
  78. Ted ZlatanovJan 30, 2013

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.