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

Re: [PATCH] Add a knob to abort on die() (was Re: git checkout crashes after ...)

From
Jeff King <peff@peff.net>
Date
Oct 19, 2016, 21:15 UTC
Message-ID
<20161019211509.mqt5cqy24eu6wptk@sigill.intra.peff.net>
In-Reply-To
<20161019134750.GA7256@ash>
On Wed, Oct 19, 2016 at 08:47:50PM +0700, Duy Nguyen wrote:
Show 16 quoted lines
> On Wed, Oct 19, 2016 at 08:27:43PM +0700, Duy Nguyen wrote:
> > If you set the environment variable GIT_ALLOC_LIMIT ...  git
> > attempts to allocate more than that ... then it's caught and we get
> > a glimpse of how much memory git may need. Unfortunately we can't
> > get a stack trace or anything like that unless you rebuild Git from
> > source.
> 
> It's moments like this that I wish we had a knob to force core
> dumps. And I often modify die_builtin() to add '*(char*)0 = 1;' to
> force a core dump when I can't figure out some problem based on the
> error message alone.
> 
> So.. how about we do something like this? We could extend it to abort
> on error() as well as die(). Aborting on warning() may be a bit too
> much though. On glibc systems we could even print the back trace
> without aborting, which helps in some cases.

I have been tempted by something like this, too, and have occasionally resorted to patching in an abort() call to get cores from sub-processes.

I'm not sure how useful it would be in practice in deployed versions of git, though. You'd have to coach the user into finding the core file and generating the backtrace from it. Something that called backtrace(3) automatically would be more seamless (but provides worse information than gdb), and otherwise it is probably just as easy to ship the user cut-and-paste instructions to use gdb.

See the previous discussion in this subthread:
  http://public-inbox.org/git/20150424201734.GA4747@peff.net/T/#u
-Peff
Previous: Duy Nguyen
Message 7 of 7 in “git checkout crashes after server being updated to Debian X86_64”
  1. Raffael ReicheltOct 18, 2016
  2. René ScharfeOct 18, 2016
  3. Raffael ReicheltOct 18, 2016
  4. Duy NguyenOct 19, 2016
  5. Raffael ReicheltOct 19, 2016
  6. Add a knob to abort on die() (was Re: git checkout crashes after ...)Duy Nguyen, Oct 19, 2016
  7. Jeff KingOct 19, 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.