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

Re: [PATCH 2/2] Remember and use GIT_EXEC_PATH on exec()'s

From
Junio C Hamano <junkio@cox.net>
Date
Jan 10, 2006, 02:52 UTC
Message-ID
<7vwth8bxqd.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<1136849810.11717.518.camel@brick.watson.ibm.com>
Michal Ostrowski <mostrows@watson.ibm.com> writes:
> Calls to git_setup_exec_path() are inserted on paths that will execute
> other git programs. git_setup_exec_path() will ensure that the git
> installation directories are in the path.

About fetch-clone.c (which is shared by fetch-pack and clone-pack), it runs "git-index-pack" from finish_pack and "git-unpack-objects" from unpack_pack, so spelling these exec with execlp("git", "git", "index-pack", ...) might be cleaner, since "git" is required to be in users' PATH even though git-* may be moved out of the PATH in later versions of git. I dunno...

In send-pack.c, I wonder why you didn't do a setup_exec_path() at the beginning of main() instead of having two calls close to exec*() call site.

The same comment applies for run-command.c; you do it once for each child, but calling it once at the beginning of receive-pack would be good enough. The same thing for daemon.c.

I suspect you are trying to limit the extent of damage, but I do not think of a downside if we just call setup_exec_path() once at the beginning of main(). $GIT_EXEC_PATH _could_ have a private copy of broken "diff" to confuse diff-* family, but you cannot say "git diff" in such a setup anyway because "git" does the PATH prefixing already, so it would be a moot point.

Here is the list my "nm | grep ' exec[vlpe]*\($\|@@\)'" found that use some variant of exec* family (except "git-diff-*"):

	clone-pack
        daemon
        fetch-pack
        merge-index
        peek-remote
        receive-pack
        send-pack
        shell
        ssh-fetch/ssh-pull
        ssh-upload/ssh-push
        upload-pack

I do not care too much about ssh-* commit walkers (users can say e.g. GIT_SSH_PUSH themselves).

Anyway, thanks for starting this. I need a bit more thought and a bit of list discussion to convince myself this is a good change.

Previous: Michal OstrowskiNext: Michal Ostrowski
Message 5 of 33 in “Remember and use GIT_EXEC_PATH on exec()'s”
  1. 0/2 Remember and use GIT_EXEC_PATH on exec()'sMichal Ostrowski, Jan 9, 2006
  2. 1/2 Remember and use GIT_EXEC_PATH on exec()'sMichal Ostrowski, Jan 9, 2006
  3. Junio C HamanoJan 10, 2006
  4. 2/2 Remember and use GIT_EXEC_PATH on exec()'sMichal Ostrowski, Jan 9, 2006
  5. Junio C HamanoJan 10, 2006
  6. Michal OstrowskiJan 10, 2006
  7. Andreas EricssonJan 10, 2006
  8. Michal OstrowskiJan 10, 2006
  9. Andreas EricssonJan 10, 2006
  10. Alex RiesenJan 10, 2006
  11. Michal OstrowskiJan 10, 2006
  12. Junio C HamanoJan 10, 2006
  13. Johannes SchindelinJan 10, 2006
  14. Michal OstrowskiJan 10, 2006
  15. Johannes SchindelinJan 10, 2006
  16. Andreas EricssonJan 11, 2006
  17. Junio C HamanoJan 11, 2006
  18. Andreas EricssonJan 11, 2006
  19. Jon LoeligerJan 11, 2006
  20. Junio C HamanoJan 10, 2006
  21. Michal OstrowskiJan 10, 2006
  22. Andreas EricssonJan 11, 2006
  23. Junio C HamanoJan 11, 2006
  24. Michal OstrowskiJan 11, 2006
  25. Exec git programs without using PATH.Michal Ostrowski, Jan 11, 2006
  26. Junio C HamanoJan 11, 2006
  27. (Updated) Exec git programs without using PATH.Michal Ostrowski, Jan 11, 2006
  28. Junio C HamanoJan 11, 2006
  29. Linus TorvaldsJan 11, 2006
  30. Michal OstrowskiJan 11, 2006
  31. Junio C HamanoJan 11, 2006
  32. Andreas EricssonJan 12, 2006
  33. H. Peter AnvinJan 12, 2006

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.