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

Re: [PATCH] Always check the return value of `repo_read_object_file()`

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 9, 2024, 16:37 UTC
Message-ID
<xmqqjzndk302.fsf@gitster.g>
In-Reply-To
<5fd95ae0-cd50-ddc4-5095-ee953c2640b3@gmx.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 6 quoted lines
> It does change behavior. The previous behavior looked up the note OID,
> then tried to read it, and if it was missing just pretended that there had
> not been a note.
>
> I'm not quite sure whether we should keep that behavior, as it is unclear
> in which scenarios it would be desirable to paper over missing objects.

Yeah, an object that does not have any notes attached to is a norm so the calling application must be prepared for it, but this codepath is different. The notes tree says it has notes, we try to read it and it is not there---at least we noticed an inconsistent notes tree (and object store), and if we were to run "git fsck" at that point, we would certainly complain about a missing blob object (can a tree object at an intermediate level be missing and would we notice, by the way, I wonder). It is only prudent to report it, instead of pretending that the notes are not there.

So I think this tightening falls into the "bugfix" category.
Thanks.
Previous: Johannes SchindelinNext: Kyle Lippincott
Message 7 of 16 in “Always check the return value of `repo_read_object_file()`”
  1. Always check the return value of `repo_read_object_file()`Johannes Schindelin via GitGitGadget, Feb 5, 2024
  2. Karthik NayakFeb 5, 2024
  3. Junio C HamanoFeb 6, 2024
  4. Johannes SchindelinFeb 12, 2024
  5. Kyle LippincottFeb 6, 2024
  6. Johannes SchindelinFeb 9, 2024
  7. Junio C HamanoFeb 9, 2024
  8. Kyle LippincottFeb 9, 2024
  9. Patrick SteinhardtFeb 6, 2024
  10. Junio C HamanoFeb 6, 2024
  11. Johannes SchindelinFeb 9, 2024
  12. Patrick SteinhardtFeb 9, 2024
  13. Junio C HamanoFeb 6, 2024
  14. Johannes SchindelinFeb 12, 2024
  15. Always check the return value of `repo_read_object_file()`Teng Long, Feb 16, 2024
  16. Johannes SchindelinFeb 18, 2024

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.