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

Re: Fw: git-core: SIGSEGV during {peek,ls}-remote on HTTP remotes.

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Nov 2, 2009, 00:59 UTC
Message-ID
<alpine.LNX.2.00.0911011829130.14365@iabervon.org>
In-Reply-To
<20091101230442.GA20264@coredump.intra.peff.net>
On Sun, 1 Nov 2009, Jeff King wrote:
Show 38 quoted lines
> On Sun, Nov 01, 2009 at 04:19:34PM -0500, Daniel Barkalow wrote:
> 
> > > > Do things like git_path() fail cleanly if there was no git directory?  If
> > > > not, there should probably be tests of nongit on paths that actually need 
> > > > a git directory,...
> > > 
> > > I don't know.  Again, you tell me ;-)
> > 
> > I'm not an expert on that part. But it looks like it misbehaves, returning 
> > ".git/foo" even when that path doesn't make sense.
> 
> I will not admit to being an expert in that area, but yes, that is what
> I observed before while looking into some of our weird startup problems.
> We really have two systems for setting up the environment:
> 
>   - setup_git_directory, which tries to do everything at the outset (but
>     which we don't necessarily run for all commands, and where "outset"
>     is defined as when the git wrapper handles an actual command, which
>     means we sometimes do quite a bit of stuff beforehand)
> 
>   - some lazy magic in environment.c, mostly setup_git_env. If
>     setup_git_directory has been run, this does the right thing because
>     it reads GIT_DIR from the environment as set previously. But if not,
>     then it can quite often do the wrong thing (as you noticed).
> 
> I tried simply ditching the lazy magic, but that doesn't work: there are
> many cases where setup_git_directory hasn't been run. Moving it to the
> very beginning doesn't quite work, either. I don't remember the details,
> sadly. It may be that the lazy setup_git_env magic should, rather than
> doing anything itself, call setup_git_directory if it has not been
> initialized. But at that point, you might as well setup_git_directory in
> every program, since just about every one is going to want to look at
> git_path at some point.
> 
> Sorry, I know that is vague. Refactoring this area has been on my plate
> for so long that I have forgotten all the details, and it is such a
> messy area that I am continually procrastinating on diving back into it.
> ;)

I've been looking at it, just now, and I might try to clean stuff up. The problem I'm running into is that, in some cases, you have to call setup_git_directory_gently(), and it might determine that there is no git repo, but then the various environment functions don't distinguish between the situation where you haven't called it at all and the situation where you called it and determined there to be no answer. Furthermore, a lot of functions seem to be getting git_path(something), ignoring the fact that there is no repo, and acting like there is a repo that has simply not got the file it is looking for.

	-Daniel
*This .sig left intentionally blank*
Previous: Jeff KingNext: Clemens Buchacher
Message 11 of 13 in “Fw: git-core: SIGSEGV during {peek,ls}-remote on HTTP remotes.”
  1. Samium GromoffOct 31, 2009
  2. Junio C HamanoNov 1, 2009
  3. Sverre RabbelierNov 1, 2009
  4. Daniel BarkalowNov 1, 2009
  5. Sverre RabbelierNov 1, 2009
  6. Junio C HamanoNov 2, 2009
  7. Daniel BarkalowNov 1, 2009
  8. Junio C HamanoNov 1, 2009
  9. Daniel BarkalowNov 1, 2009
  10. Jeff KingNov 1, 2009
  11. Daniel BarkalowNov 2, 2009
  12. Clemens BuchacherNov 2, 2009
  13. Mike HommeyNov 1, 2009

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.