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

Re: Git in next is broken

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Nov 13, 2009, 09:14 UTC
Message-ID
<alpine.LNX.2.00.0911130910150.17726@reaper.quantumfyre.co.uk>
In-Reply-To
<alpine.LFD.2.00.0911122345450.16711@xanadu.home>
On Thu, 12 Nov 2009, Nicolas Pitre wrote:
Show 10 quoted lines
> On Thu, 12 Nov 2009, Julian Phillips wrote:
>
>> On Thu, 12 Nov 2009, Ren? Scharfe wrote:
>>
>>> Nicolas Pitre schrieb:
>>>> Simply issuing a "git fetch" in my copy of git.git makes glibc complain
>>>> with this:
>>>>
>>>> *** glibc detected *** git: corrupted double-linked list:
>>>> 0x0000000000974180 ***
Show 30 quoted lines
>>> Can't reproduce because I don't know how to create duplicate refs, but does
>>> the following help?
>
> Nope.
>
>>> remote.c |    2 ++
>>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/remote.c b/remote.c
>>> index 4f9f0cc..10cc985 100644
>>> --- a/remote.c
>>> +++ b/remote.c
>>> @@ -754,6 +754,8 @@ void ref_remove_duplicates(struct ref *ref_map)
>>> 			prev->next = ref_map->next;
>>> 			free(ref_map->peer_ref);
>>> 			free(ref_map);
>>> +			ref_map = next;
>>
>> You don't need this line (this is taken care of in the for(...)).
>>
>>> +			continue;
>>
>> Ack. This one however, you do need.  Good catch.
>
> Without the "ref_map = next" there is no change: glibc still complains
> about corruption and abort the execution.  With the "ref_map = next"
> then git simply segfaults.
>
> I simply have zero time to investigate the issue myself now
> unfortunately.

I was half right about "ref_map = next", I had forgotten about setting prev in the for(...). For me, the following fixes it on MacOS (I don't have time to test on Linux right now):

diff --git a/remote.c b/remote.c
index 4f9f0cc..6195a58 100644
--- a/remote.c
+++ b/remote.c
@@ -754,6 +754,8 @@ void ref_remove_duplicates(struct ref *ref_map)
                         prev->next = ref_map->next;
                         free(ref_map->peer_ref);
                         free(ref_map);
+                       ref_map = prev; // Keep the same prev.
+                       continue;
                 }

                 item = string_list_insert(ref_map->peer_ref->name, &refs);
-- 
Julian

  ---
C'est magnifique, mais ce n'est pas l'Informatique.
 		-- Bosquet [on seeing the IBM 4341]
Previous: Nicolas PitreNext: Nicolas Pitre
Message 5 of 8 in “Git in next is broken”
  1. Nicolas PitreNov 12, 2009
  2. René ScharfeNov 12, 2009
  3. Julian PhillipsNov 12, 2009
  4. Nicolas PitreNov 13, 2009
  5. Julian PhillipsNov 13, 2009
  6. Nicolas PitreNov 13, 2009
  7. Eric RaibleNov 13, 2009
  8. remote: Fix glibc error in ref_remove_duplicatesJulian Phillips, Nov 13, 2009

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.