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

Re: [PATCH] fsck: it is OK for a tag and a commit to lack the body

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jun 28, 2015, 18:21 UTC
Message-ID
<CAPig+cR8MzEX+-Xi8YD7K=iHmYB3hjZKraFcyJ0mqKzY16HS8g@mail.gmail.com>
In-Reply-To
<xmqqlhf3elxk.fsf_-_@gitster.dls.corp.google.com>
On Sun, Jun 28, 2015 at 2:18 PM, Junio C Hamano <gitster@pobox.com> wrote:
> When fsck validates a commit or a tag object, it scans each line in
> the header the object using helper functions such as "start_with()",
s/header/& of/
Show 27 quoted lines
> etc. that work on a NUL terminated buffer, but before a1e920a0
> (index-pack: terminate object buffers with NUL, 2014-12-08), the
> validation functions were fed the object data as counted strings,
> not necessarily terminated with a NUL.  We added a helper function
> require_end_of_header() to be called at the beginning of these
> validation functions to insist that the object data contains an
> empty line before its end.  The theory is that the validating
> functions will notice and stop when it hits an empty line as a
> normal end of header (or a required header line that is missing)
> before scanning past the end of potentially not NUL-terminated
> buffer.
>
> But the theory forgot that in the older days, Git itself happily
> created objects with only the header lines without a body. This
> caused Git 2.2 and later to issue an unnecessary warning on some
> existing repositories.
>
> With a1e920a0, we do not need to require an empty line (or the body)
> in these objects to safely parse and validate them.  Drop the
> offending "must have an empty line" check from this helper function,
> while keeping the other check to make sure that there is no NUL in
> the header part of the object, and adjust the name of the helper to
> what it does accordingly.
>
> Noticed-by: Wolfgang Denk <wd@denx.de>
> Helped-by: Jeff King <peff@peff.net>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previous: Junio C HamanoNext: Johannes Schindelin
Message 14 of 19 in “git error in tag ...: unterminated header”
  1. Wolfgang DenkJun 25, 2015
  2. Junio C HamanoJun 25, 2015
  3. Wolfgang DenkJun 25, 2015
  4. Junio C HamanoJun 25, 2015
  5. Johannes SchindelinJun 25, 2015
  6. Junio C HamanoJun 25, 2015
  7. Junio C HamanoJun 25, 2015
  8. Johannes SchindelinJun 26, 2015
  9. Jeff KingJun 26, 2015
  10. Junio C HamanoJun 26, 2015
  11. Johannes SchindelinJun 27, 2015
  12. Junio C HamanoJun 27, 2015
  13. fsck: it is OK for a tag and a commit to lack the bodyJunio C Hamano, Jun 28, 2015
  14. Eric SunshineJun 28, 2015
  15. Johannes SchindelinJun 29, 2015
  16. Junio C HamanoJun 29, 2015
  17. Johannes SchindelinJun 29, 2015
  18. Junio C HamanoJun 25, 2015
  19. Junio C HamanoJun 25, 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.