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

Re: [PATCH 80/83] run-command: make dup_devnull() non static

From
Junio C Hamano <gitster@pobox.com>
Date
May 9, 2016, 17:40 UTC
Message-ID
<xmqq4ma7w2nx.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CACsJy8DUcLWQ6AwyLE+CF+TxZtqDLS=82peizSf4TrZ3q=qjJg@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 7 quoted lines
> I vote one step at a time, leave multi-thread support for future.
> There's a lot more shared state than file descriptors anyway, at least
> there are object db and index access and probably a couple of hidden
> static variables somewhere. And I'm not sure if multi-thread really
> helps here. Are we really CPU-bound? If object inflation causes that
> (wild guess), can we just inflate ahead in some separate process and
> pass the result back?

I do not particularly care about multi-thread issues, but I have to agree with Dscho that the updated code that claims to be "libified" that futz with the file descriptors like the way this patch does is not a proper libification.

Unfortunately, the anticipated caller of this code that does "this may fail and it is OK because it is merely one of the attempts, so let's not show the errors" is not something we call only when we are falling back, so "why not do this rare codepath via the usual run_command() interface to spawn 'apply' as a separate process?", which would be the most sensible "one step at a time" suggestion if it were the case, would not apply.

As you will be passing the apply state structure throughout the callchain, would it be a viable and reasonable endgame state to have a strbuf in it that accumulates the errors? That is, instead of dup()ing the standard error stream out, you would accumulate the errors for a caller that asks their errors not directly sent to the standard error stream, so that it can choose to either show it at the end, or ignore it altogether.

How far can you go with just set-error-routine? Are there things, other than the file descriptors, that you need to futz with in order to covert that "we'd fallback, so this early round must be silent" codepath?

Previous: Johannes Schindelin
Message 24 of 24 in “run-command: make dup_devnull() non static”
  1. 80/83 run-command: make dup_devnull() non staticChristian Couder, Apr 24, 2016
  2. 81/83 apply: roll back index in case of errorChristian Couder, Apr 24, 2016
  3. Johannes SchindelinApr 25, 2016
  4. Johannes SchindelinMay 2, 2016
  5. Eric SunshineMay 2, 2016
  6. Christian CouderMay 3, 2016
  7. 82/83 environment: add set_index_file()Christian Couder, Apr 24, 2016
  8. Junio C HamanoMay 3, 2016
  9. Christian CouderMay 4, 2016
  10. 83/83 builtin/am: use apply api in run_apply()Christian Couder, Apr 24, 2016
  11. Johannes SchindelinApr 25, 2016
  12. Christian CouderMay 5, 2016
  13. Johannes SchindelinApr 25, 2016
  14. Christian CouderMay 5, 2016
  15. Johannes SixtMay 5, 2016
  16. Christian CouderMay 6, 2016
  17. Johannes SchindelinMay 6, 2016
  18. Christian CouderMay 7, 2016
  19. Johannes SchindelinMay 7, 2016
  20. Christian CouderMay 7, 2016
  21. Johannes SchindelinMay 8, 2016
  22. Duy NguyenMay 8, 2016
  23. Johannes SchindelinMay 9, 2016
  24. Junio C HamanoMay 9, 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.