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

Re: [PATCH] name-rev: change ULONG_MAX to TIME_MAX

From
Michael J Gruber <git@grubix.eu>
Date
Sep 7, 2017, 12:17 UTC
Message-ID
<c1cb526d-a567-b598-d980-5dbe695b7d6a@grubix.eu>
In-Reply-To
<20170906133519.amlc5yunx4yfl5u3@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 06.09.2017 15:35:
Show 32 quoted lines
> On Wed, Sep 06, 2017 at 01:59:31PM +0200, Michael J Gruber wrote:
> 
>> BTW, there's more fallout from those name-rev changes: In connection
>> with that other thread about surprising describe results for emacs.git I
>> noticed that I can easily get "git name-rev --stdin" to segfault there.
>> As easy as
>>
>> echo bc5d96a0b2a1dccf7eeeec459e40d21b54c977f4 | git name-rev --stdin
>>
>> for example.
>>
>> That's unfortunate for the use-case of name-rev to amend git log output.
>>
>> The reason seems to be that with "--stdin" or "--all", "name-rev" walks
>> and names all commits before beginning to use that those names for even
>> a single commit as above.
>>
>> That segfault bisects to the logic changing commit in
>> jc/name-rev-lw-tag, but I think the changed logic simply leads to more
>> xmallocs() the segfault sooner now. Or something that I dind't spot even
>> after a few hours.
> 
> The segfault seems to be due to running out of stack space. The problem
> is that name_rev() is recursive over the history graph.  That topic
> added a parameter to the function, which increased the memory used for
> each level of the recursion. But the fundamental problem has always been
> there. The right solution is to switch to iteration (with our own stack
> structure if necessary).
> 
> We had similar problems with the recursive --contains traversal in tag,
> and ended up with cbc60b6720 (git tag --contains: avoid stack overflow,
> 2014-04-24).
Cool, thanks for the pointer. ulimit -s is a great way to test this.
Michael
Previous: Jeff KingNext: Michael J Gruber
Message 6 of 14 in “name-rev: change ULONG_MAX to TIME_MAX”
  1. name-rev: change ULONG_MAX to TIME_MAXMichael J Gruber, Aug 30, 2017
  2. Johannes SchindelinAug 30, 2017
  3. Junio C HamanoSep 6, 2017
  4. Michael J GruberSep 6, 2017
  5. Jeff KingSep 6, 2017
  6. Michael J GruberSep 7, 2017
  7. 2/4 t6120: test name-rev --all and --stdinMichael J Gruber, Sep 7, 2017
  8. 4/4 t6120: test describe and name-rev with deep reposMichael J Gruber, Sep 7, 2017
  9. 1/4 t7004: move limited stack prereq to test-libMichael J Gruber, Sep 7, 2017
  10. 3/4 t6120: clean up state after breaking repoMichael J Gruber, Sep 7, 2017
  11. 0/4 Test name-rev with small stackMichael J Gruber, Sep 7, 2017
  12. Jeff KingSep 7, 2017
  13. Michael J GruberSep 8, 2017
  14. Jeff KingSep 11, 2017

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.