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

Re: [PATCH v2 4/5] index-pack, unpack-objects: add --not-so-strict for connectivity check

From
Junio C Hamano <gitster@pobox.com>
Date
May 2, 2013, 16:27 UTC
Message-ID
<7vvc711h4m.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CACsJy8A2dYssdV7JHutYKgo-nZswBAuedXoJ=aygrVSR=JeTrw@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 19 quoted lines
> On Thu, May 2, 2013 at 6:35 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>>
>>> --not-so-strict only checks if all links from objects in the pack
>>> point to real objects (either in current repo, or from the pack
>>> itself). It's like check_everything_connected() except that:
>>>
>>>  - it does not follow DAG in order
>>>  - it can detect incomplete object islands
>>
>> Could you clarify what this second point means?
>>
>> "rev-list --objects --all --not $this $that" does not detect
>> "islands" but checking with the updated index-pack does?
>
> Object islands (in the new pack) by definition are not connected to
> the main DAG and so invisible to/unreachable from rev-list. index-pack
> examines all objects in the pack and checks links of each object. With
> this approach, islands are no different than reachable objects.

OK, so if you are fetching an updated tip of the main history, and a new tip of a history that is disjoint. If we imagine that my public repository just added the 'todo' branch and you are fecting them for the first time. The history of 'todo' branch is an island that is not connected anywhere from your refs namespace yet. In order to ensure that updating the tip of fetched 'todo' is safe, you would need to verify the island is free of dangling pointers and the only thing you need to be sure is the tip of 'todo' is _in_ that island.

Show 9 quoted lines
>> I am guessing that the code assumes that we are updating our refs to
>> objects that are in the pack that we are looking at, and I can see
>> how the new check in sha1_object() may detect an object that points
>> at another object that is missing.  But that assumption (which I
>> think is correct) is probably the most important thing to say in the
>> log message.
>
> Yes, we need to make sure the new value of our refs are existing
> objects. But it does not need to be in the new pack.

It is a bit more tricky than that. A malicious (or simply buggy) other side can send a subset of my 'todo' branch, which is an island that is free of dangling pointers (think: 'rev-list --objects todo~8'). Further imagine that you earlier attempted a fetch of the same history from me over a commit walker and you happen to have partial history near the tip of 'todo' but not connected to the island. sha1_object() will find it, but that does not say anything useful. The tip _must_ appear in the island for your check to yield a usable result, no?

The existing "everything connected" was designed to protect against that kind of breakage as well.

I might be reading your change incorrectly, but I am not sure how the new code protects against such a breakage.

> After index-pack
> is run, we're guaranteed that all objects in repo are connected and
> any of them could be new ref. This is also why I add has_sha1_file()
> in clone.c.
Previous: Duy NguyenNext: Duy Nguyen
Message 18 of 35 in “check_everything_connected replacement”
  1. 0/4 check_everything_connected replacementNguyễn Thái Ngọc Duy, Mar 31, 2013
  2. 1/4 fetch-pack: save shallow file before fetching the packNguyễn Thái Ngọc Duy, Mar 31, 2013
  3. Junio C HamanoApr 1, 2013
  4. Duy NguyenApr 5, 2013
  5. 2/4 index-pack: remove dead code (it should never happen)Nguyễn Thái Ngọc Duy, Mar 31, 2013
  6. 3/4 index-pack, unpack-objects: add --not-so-strict for connectivity checkNguyễn Thái Ngọc Duy, Mar 31, 2013
  7. 4/4 Use --not-so-strict on all pack transfer for connectivity checkNguyễn Thái Ngọc Duy, Mar 31, 2013
  8. Junio C HamanoApr 1, 2013
  9. 0/5 check_everything_connected replacementNguyễn Thái Ngọc Duy, May 1, 2013
  10. 1/5 clone: let the user know when check_everything_connected is runNguyễn Thái Ngọc Duy, May 1, 2013
  11. 2/5 fetch-pack: prepare updated shallow file before fetching the packNguyễn Thái Ngọc Duy, May 1, 2013
  12. Junio C HamanoMay 1, 2013
  13. Duy NguyenMay 2, 2013
  14. 3/5 index-pack: remove dead code (it should never happen)Nguyễn Thái Ngọc Duy, May 1, 2013
  15. 4/5 index-pack, unpack-objects: add --not-so-strict for connectivity checkNguyễn Thái Ngọc Duy, May 1, 2013
  16. Junio C HamanoMay 1, 2013
  17. Duy NguyenMay 2, 2013
  18. Junio C HamanoMay 2, 2013
  19. Duy NguyenMay 3, 2013
  20. Junio C HamanoMay 3, 2013
  21. Junio C HamanoMay 3, 2013
  22. Duy NguyenMay 3, 2013
  23. Eric SunshineMay 3, 2013
  24. 5/5 Use --not-so-strict on all pack transfer for connectivity checkNguyễn Thái Ngọc Duy, May 1, 2013
  25. 0/4 check_everything_connected replacementNguyễn Thái Ngọc Duy, May 3, 2013
  26. 1/4 clone: let the user know when check_everything_connected is runNguyễn Thái Ngọc Duy, May 3, 2013
  27. 2/4 fetch-pack: prepare updated shallow file before fetching the packNguyễn Thái Ngọc Duy, May 3, 2013
  28. Eric SunshineMay 3, 2013
  29. Junio C HamanoMay 7, 2013
  30. Duy NguyenMay 26, 2013
  31. 3/4 index-pack: remove dead code (it should never happen)Nguyễn Thái Ngọc Duy, May 3, 2013
  32. 4/4 clone: open a shortcut for connectivity checkNguyễn Thái Ngọc Duy, May 3, 2013
  33. Eric SunshineMay 3, 2013
  34. Junio C HamanoMay 3, 2013
  35. Duy NguyenMay 4, 2013

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.