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

Re: [PATCH] usage: try harder to format very long error messages

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 11, 2015, 16:34 UTC
Message-ID
<xmqqtws5ss14.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20150811161752.GA14829@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> We use a fixed-size buffer of 4096 bytes to format die() and
> error() messages. We explicitly avoided using a strbuf or
> other fanciness here, because we want to make sure that we
> report the message even in the face of malloc() failure
> (after all, we might even be dying due to a malloc call).

Yes, that was the rationale behind the "we use a fixed-buffer and try not to allocate in this codepath", I think.

Show 5 quoted lines
> As for vwritef, it exists solely to work over write(), _and_ it doesn't
> get the "one-shot" thing right (which is probably OK, as we use it only
> when exec fails). But we could probably teach run-command to fdopen(),
> and get rid of it entirely (in favor of teaching vreportf to take a
> FILE* handle instead of assuming stderr).
Sounds like a plan ;-)
The patch looks very sensible.
Previous: Jeff KingNext: Jeff King
Message 4 of 7 in “usage: try harder to format very long error messages”
  1. usage: try harder to format very long error messagesJeff King, Aug 11, 2015
  2. Stefan BellerAug 11, 2015
  3. Jeff KingAug 11, 2015
  4. Junio C HamanoAug 11, 2015
  5. Jeff KingAug 11, 2015
  6. 1/2 vreportf: report to arbitrary filehandlesJeff King, Aug 11, 2015
  7. 2/2 vreportf: avoid intermediate bufferJeff King, Aug 11, 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.