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

Re: git-clone fails when current user is not in /etc/passwd

From
Jeff King <peff@peff.net>
Date
Dec 10, 2015, 18:34 UTC
Message-ID
<20151210183426.GA27609@sigill.intra.peff.net>
In-Reply-To
<CAKfKJYuP1E5aC7SPO91j-KS-P41pYaM7NkTJ9uG6b=VvxbOBwg@mail.gmail.com>
On Wed, Dec 09, 2015 at 05:35:52PM -0500, Taylor Braun-Jones wrote:
Show 7 quoted lines
> > Well.. reflog needs it. So either you disable reflog at clone time or
> > define name/email via config file. I don't see anything wrong with
> > this behavior.
> 
> Can't git just use "unknown" and "unknown@localhost" if the name or
> email can not be determined from xgetpwuid? This seems to be the way
> that Mercurial behaves.

Yeah, I think there is a mismatch here in the ident code. When we are making a commit (which is likely to get published and is set in stone), we ask for "IDENT_STRICT", which will barf if we can't come up with something sensible. For reflogs, we are OK putting whatever auto-generated crap in there we can come up with.

But before we even hit the strict-check, we call xgetpwuid_self(), which unconditionally dies on failure. I think that function needs to be taught a "gently" form which we use for non-strict ident lookups. Unfortunately it's a little non-trivial because the strictness will need to get passed all the way down to ident_default_name() (and we need to make sure that a non-strict check followed by a strict one does not fail; i.e., that the first does not pollute the contents of git_default_name).

-Peff
Previous: Taylor Braun-JonesNext: Junio C Hamano
Message 7 of 20 in “git-clone fails when current user is not in /etc/passwd”
  1. Taylor Braun-JonesDec 2, 2015
  2. Taylor Braun-JonesDec 9, 2015
  3. Duy NguyenDec 9, 2015
  4. Duy NguyenDec 9, 2015
  5. Taylor Braun-JonesDec 9, 2015
  6. Taylor Braun-JonesDec 10, 2015
  7. Jeff KingDec 10, 2015
  8. Junio C HamanoDec 10, 2015
  9. Jeff KingDec 10, 2015
  10. 0/3 git-clone fails when current user is not in /etc/passwdJeff King, Dec 10, 2015
  11. 1/3 ident: make xgetpwuid_self() a static local helperJeff King, Dec 10, 2015
  12. Junio C HamanoDec 10, 2015
  13. 2/3 ident: keep a flag for bogus default_emailJeff King, Dec 10, 2015
  14. Jeff KingDec 10, 2015
  15. 3/3 ident: loosen getpwuid error in non-strict modeJeff King, Dec 10, 2015
  16. Jeff KingDec 14, 2015
  17. Junio C HamanoDec 10, 2015
  18. Taylor Braun-JonesDec 11, 2015
  19. Junio C HamanoDec 10, 2015
  20. Taylor Braun-JonesDec 10, 2015

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.