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

[PATCH 0/5] consistent setup code for external commands

From
Jeff King <peff@peff.net>
Date
Jul 1, 2016, 05:55 UTC
Message-ID
<20160701055532.GA4488@sigill.intra.peff.net>
In-Reply-To
<20160701040715.GB4832@sigill.intra.peff.net>
On Fri, Jul 01, 2016 at 12:07:15AM -0400, Jeff King wrote:
Show 13 quoted lines
> Interesting. It's failing on the assert(argv0_path) in system_path().
> 
> That's part of the RUNTIME_PREFIX code which is built only on Windows,
> so this is a Windows-specific issue.
> 
> I can guess the reason that argv0_path is not set is that
> credential-store has its own main() function and does not call
> git_extract_argv0_path(). It never mattered before, but as of v2.8.0,
> one of the library functions it calls wants to use system_path(), which
> assumes that the argv0 stuff has been set up.
> 
> I'm preparing some patches to fix this case (and some other related
> ones).
Here they are:
  [1/5]: add an extra level of indirection to main()
  [2/5]: common-main: call git_extract_argv0_path()
  [3/5]: common-main: call sanitize_stdfds()
  [4/5]: common-main: call restore_sigpipe_to_default()
  [5/5]: common-main: call git_setup_gettext()

The first patch is refactoring so we can fix this problem once, rather than in the dozens of programs that need it.

The second should fix the problem you saw. It's unfortunate that the tests didn't detect it; there's some discussion of that in the commit message.

Patches 3-5 are other places where we can use the refactoring to be more consistent and remove boilerplate code.

I almost did a patch 6 moving trace_command_performance(), but I'm not sure if people would care or not. Running "git foo" already covers that, even for an external command, because the git wrapper waits until the sub-process finishes. Setting it up in each sub-program would mean:

  - you get it for dashed externals you run directly, too
  - for external programs run as "git foo", you get _two_ times. One for
    the time the actual sub-program ran, and one with the overhead of
    the git wrapper process.
    I'm not sure if people actually care about that distinction, or
    whether the extra number would simply be annoying.
So I punted. It's easy to move it over later if anybody cares.
-Peff
Previous: Jeff KingNext: Jeff King
Message 3 of 21 in “git-credentials-store.exe crash”
  1. dmh@ucar.eduJun 30, 2016
  2. Jeff KingJul 1, 2016
  3. 0/5 consistent setup code for external commandsJeff King, Jul 1, 2016
  4. 1/5 add an extra level of indirection to main()Jeff King, Jul 1, 2016
  5. Johannes SchindelinJul 1, 2016
  6. Jeff KingJul 1, 2016
  7. Johannes SchindelinJul 1, 2016
  8. Jeff KingJul 1, 2016
  9. Johannes SchindelinJul 2, 2016
  10. 2/5 common-main: call git_extract_argv0_path()Jeff King, Jul 1, 2016
  11. Johannes SchindelinJul 1, 2016
  12. 3/5 common-main: call sanitize_stdfds()Jeff King, Jul 1, 2016
  13. 5/5 common-main: call git_setup_gettext()Jeff King, Jul 1, 2016
  14. 4/5 common-main: call restore_sigpipe_to_default()Jeff King, Jul 1, 2016
  15. Johannes SchindelinJul 1, 2016
  16. Junio C HamanoJul 1, 2016
  17. Jeff KingJul 1, 2016
  18. Junio C HamanoJul 6, 2016
  19. Johannes SchindelinJul 6, 2016
  20. Johannes SchindelinJul 1, 2016
  21. Jeff KingJul 1, 2016

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.