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

Re: [PATCH v4 2/2] merge-ort: return early when failing to write a blob

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 27, 2022, 16:45 UTC
Message-ID
<xmqqill87om9.fsf@gitster.g>
In-Reply-To
<CABPp-BHau2qwoxj121H-cpjTPPCpfxjMpmhya0mV79qyvkpQ+g@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 19 quoted lines
>> Since we will always write out a new tree object in addition to the blob
>> (and if the blob did not exist in the database yet, we can be certain
>> that the tree object did not exist yet), the merge will _still_ fail at
>> that point, but it does unnecessary work by continuing after the blob
>> could not be written.
>
> I don't think this is quite true.  I've had a number of users come to
> me with "messed up git repositories" where I eventually discover that
> users just randomly add "sudo" to some of their commands because when
> things don't work, sometimes "sudo" fixes it.  That means they've
> created stuff in their .git directory which may be owned by root,
> perhaps even some of the .git/objects/XX directories.  However, they
> may have other .git/objects/XX directories owned by their normal user.
>
> If just some .git/objects/XX directories are owned by root and not
> others, then it may be when users run git commands as themselves that
> some things can be written to the object database but not others.  In
> particular, it could be that writing blob objects fail, but writing a
> tree object which references those blobs succeeds.

It is a good example scenario that argues even more strongly for this change. We may know the correct object contents and name for the top-level tree and even manage to write it out, after computing all the blobs and the trees contained within, some of which we may know the object name but have failed to write out. Letting such a breakage unnoticed would be, eh, bad.

> Patch looks good to me, though.
Yup, thanks for a review.
Previous: Elijah NewrenNext: Johannes Schindelin via GitGitGadget
Message 21 of 29 in “merge-tree: fix segmentation fault in read-only repositories”
  1. merge-tree: fix segmentation fault in read-only repositoriesJohannes Schindelin via GitGitGadget, Sep 21, 2022
  2. Taylor BlauSep 21, 2022
  3. Johannes SchindelinSep 21, 2022
  4. Junio C HamanoSep 21, 2022
  5. Johannes SchindelinSep 21, 2022
  6. merge-tree: fix segmentation fault in read-only repositoriesJohannes Schindelin via GitGitGadget, Sep 21, 2022
  7. Junio C HamanoSep 21, 2022
  8. Johannes SchindelinSep 22, 2022
  9. Elijah NewrenSep 21, 2022
  10. Junio C HamanoSep 21, 2022
  11. Johannes SchindelinSep 22, 2022
  12. Johannes SchindelinSep 22, 2022
  13. Elijah NewrenSep 23, 2022
  14. merge-ort: fix segmentation fault in read-only repositoriesJohannes Schindelin via GitGitGadget, Sep 22, 2022
  15. Elijah NewrenSep 23, 2022
  16. Johannes SchindelinSep 23, 2022
  17. 0/2 merge-tree: fix segmentation fault in read-only repositoriesJohannes Schindelin via GitGitGadget, Sep 26, 2022
  18. 2/2 merge-ort: return early when failing to write a blobJohannes Schindelin via GitGitGadget, Sep 26, 2022
  19. Junio C HamanoSep 26, 2022
  20. Elijah NewrenSep 27, 2022
  21. Junio C HamanoSep 27, 2022
  22. 1/2 merge-ort: fix segmentation fault in read-only repositoriesJohannes Schindelin via GitGitGadget, Sep 26, 2022
  23. Elijah NewrenSep 27, 2022
  24. 0/2 merge-tree: fix segmentation fault in read-only repositoriesJohannes Schindelin via GitGitGadget, Sep 28, 2022
  25. 1/2 merge-ort: fix segmentation fault in read-only repositoriesJohannes Schindelin via GitGitGadget, Sep 28, 2022
  26. 2/2 merge-ort: return early when failing to write a blobJohannes Schindelin via GitGitGadget, Sep 28, 2022
  27. Junio C HamanoSep 28, 2022
  28. Elijah NewrenSep 29, 2022
  29. Junio C HamanoSep 29, 2022

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.