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

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

From
Ted Zlatanov <tzz@lifelogs.com>
Date
Feb 4, 2013, 23:42 UTC
Message-ID
<877gmnsl2q.fsf@lifelogs.com>
In-Reply-To
<20130204232317.GA17705@sigill.intra.peff.net>
On Mon, 4 Feb 2013 18:23:17 -0500 Jeff King <peff@peff.net> wrote: 
>> Perhaps "-r $file", if you say "is not accessible"?

JK> Even better: look at whether opening the file was successful. Though I JK> guess that is complicated by the use of gpg, who will probably not JK> distinguish ENOENT from other failures for us.

Yup. I think the outcome for the user will be the same, so this is mostly for debugging, right? And we do look at the outcome of opening the file, and die if that failed (which would change if your suggestion below is implemented).

JK> I was trying not to be too nit-picky with my review, but here is how I JK> would have written the outer logic of the script:

JK> my $tokens = read_credential_data_from_stdin(); JK> if ($options{file}) { JK> my @entries = load_netrc($options{file}) JK> or die "unable to open $options{file}: $!"; JK> check_netrc($tokens, @entries); JK> } JK> else { JK> foreach my $ext ('.gpg', '') { JK> foreach my $base (qw(authinfo netrc)) { JK> my @entries = load_netrc("$base$ext") JK> or next; JK> if (check_netrc($tokens, @entries)) { JK> last; JK> } JK> } JK> } JK> }

JK> I.e., to fail on "-f", but otherwise treat unreadable auto-selected JK> files as a no-op, for whatever reason.

JK> I'd also consider checking all files if they are available, in case JK> the user has multiple (e.g., they keep low-quality junk unencrypted JK> but some high-security passwords in a .gpg file). Not that likely, JK> but not any harder to implement.

I think that makes everything more complicated, and the user can name a specific netrc file in the helper spec if he wants it. It's too automagic for me. But if you and Junio feel this is the right approach, I'll rewrite to basically allow --file to take a list of filenames and default that list to the base list of ~/.{authinfo,netrc}{,.gpg}

Ted
Previous: Junio C HamanoNext: Ted Zlatanov
Message 8 of 38 in “Add contrib/credentials/netrc with GPG support”
  1. Add contrib/credentials/netrc with GPG supportTed Zlatanov, Feb 4, 2013
  2. Jeff KingFeb 4, 2013
  3. Ted ZlatanovFeb 4, 2013
  4. Add contrib/credentials/netrc with GPG support, try #2Ted Zlatanov, Feb 4, 2013
  5. Junio C HamanoFeb 4, 2013
  6. Jeff KingFeb 4, 2013
  7. Junio C HamanoFeb 4, 2013
  8. Ted ZlatanovFeb 4, 2013
  9. [PATCHv3] Add contrib/credentials/netrc with GPG supportTed Zlatanov, Feb 4, 2013
  10. Ted ZlatanovFeb 4, 2013
  11. Junio C HamanoFeb 4, 2013
  12. Ted ZlatanovFeb 4, 2013
  13. Junio C HamanoFeb 5, 2013
  14. Ted ZlatanovFeb 5, 2013
  15. Junio C HamanoFeb 5, 2013
  16. Junio C HamanoFeb 5, 2013
  17. Junio C HamanoFeb 5, 2013
  18. Ted ZlatanovFeb 5, 2013
  19. [PATCHv4] Add contrib/credentials/netrc with GPG supportTed Zlatanov, Feb 5, 2013
  20. Junio C HamanoFeb 5, 2013
  21. Ted ZlatanovFeb 5, 2013
  22. Junio C HamanoFeb 5, 2013
  23. Ted ZlatanovFeb 5, 2013
  24. [PATCHv5] Add contrib/credentials/netrc with GPG supportTed Zlatanov, Feb 5, 2013
  25. Junio C HamanoFeb 5, 2013
  26. Junio C HamanoFeb 5, 2013
  27. [PATCHv6] Add contrib/credentials/netrc with GPG supportTed Zlatanov, Feb 6, 2013
  28. Junio C HamanoFeb 7, 2013
  29. Ted ZlatanovFeb 8, 2013
  30. Junio C HamanoFeb 8, 2013
  31. Jeff KingFeb 8, 2013
  32. Ted ZlatanovFeb 25, 2013
  33. Add contrib/credentials/netrc with GPG supportTed Zlatanov, Feb 25, 2013
  34. Ted ZlatanovFeb 6, 2013
  35. Junio C HamanoFeb 5, 2013
  36. Ted ZlatanovFeb 5, 2013
  37. Junio C HamanoFeb 5, 2013
  38. Ted ZlatanovFeb 5, 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.