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

Re: Bug in fetch-pack.c, please confirm

From
Kyle J. McKay <mackyle@gmail.com>
Date
Mar 15, 2015, 22:21 UTC
Message-ID
<471A97CA-0004-48F7-B6C9-50266EE370D4@gmail.com>
In-Reply-To
<xmqq3856vhtt.fsf@gitster.dls.corp.google.com>
On Mar 15, 2015, at 00:30, Junio C Hamano wrote:
Show 26 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> "Kyle J. McKay" <mackyle@gmail.com> writes:
>>
>>> Hi guys,
>>>
>>> So I was looking at fetch-pack.c (from master @ 52cae643, but I  
>>> think
>>> it's the same everywhere):
>>>
>> ...
>>> -		hashcpy(ref->new_sha1, local);
>>> +		hashcpy(ref->new_sha1, o->sha1);
>>> 		if (!args->verbose)
>>> 			continue;
>>> 		fprintf(stderr,
>>> 			"already have %s (%s)\n", sha1_to_hex(remote),
>>> 			ref->name);
>>> 	}
>>> 	return retval;
>>> ---
>
> One thing I wonder is if this hashcpy() is doing anything useful,
> though.  Is ref->new_sha1 used after we are done in this codepath,
> or is the reason nobody noticed it is because it does not matter
> whatever garbage is in that field nobody looks at it?

My thoughts exactly. hence the "please confirm" request. I'm not familiar enough with the fetch pack code to know the answer off the top of my head. I was hoping someone else who's been in the fetch pack code recently (*Hi Peff*) might just already know. :)

Previous: Junio C HamanoNext: Jeff King
Message 4 of 14 in “Bug in fetch-pack.c, please confirm”
  1. Kyle J. McKayMar 15, 2015
  2. Junio C HamanoMar 15, 2015
  3. Junio C HamanoMar 15, 2015
  4. Kyle J. McKayMar 15, 2015
  5. Jeff KingMar 16, 2015
  6. Junio C HamanoMar 19, 2015
  7. Jeff KingMar 19, 2015
  8. Junio C HamanoMar 19, 2015
  9. Jeff KingMar 19, 2015
  10. 1/4 filter_ref: avoid overwriting ref->old_sha1 with garbageJeff King, Mar 19, 2015
  11. Junio C HamanoMar 19, 2015
  12. 2/4 filter_ref: make a copy of extra "sought" entriesJeff King, Mar 19, 2015
  13. 3/4 fetch_refs_via_pack: free extra copy of refsJeff King, Mar 19, 2015
  14. 4/4 fetch-pack: remove dead assignment to ref->new_sha1Jeff King, Mar 19, 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.