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

Re: Bug in reflog of length 0x2BFF

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 4, 2014, 22:14 UTC
Message-ID
<xmqq388vrrj9.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20141204215805.GD19953@peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> I think the bug is in the reverse-reflog reader in
> for_each_reflog_ent_reverse. It reads BUFSIZ chunks of the file in
> reverse order, and then parses them individually. If the trailing
> newline for a line falls directly on the block boundary, we may not have
> it in our current block, and pass the line to show_one_reflog_ent
> without a trailing newline.

Ahh, thanks for helping spot it. A code that uses BUFSIZ explains why a single reproduction recipe is platform dependent.

Show 8 quoted lines
> So this is a long-standing bug in for_each_reflog_ent_reverse. It just
> showed up recently because we started using that function for
> read_ref_at_ent.
> ...
> The above is a workaround. I think the right solution is probably to
> teach for_each_reflog_ent_reverse to makes sure the trailing newline is
> included (either by tweaking the reverse code, or conditionally adding
> it to the parsed buffer).

Sounds correct. Unfortunately I no longer remember how I decided to deal with a line that spans the block boundary in that piece of code X-<.

Previous: Jeff KingNext: Jeff King
Message 11 of 15 in “Bug in reflog of length 0x2BFF”
  1. Christoph MallonDec 1, 2014
  2. Christoph MallonDec 1, 2014
  3. Stefan BellerDec 1, 2014
  4. Christoph MallonDec 1, 2014
  5. Jonathan NiederDec 1, 2014
  6. Stefan BellerDec 2, 2014
  7. Christoph MallonDec 2, 2014
  8. Junio C HamanoDec 4, 2014
  9. Christoph MallonDec 4, 2014
  10. Jeff KingDec 4, 2014
  11. Junio C HamanoDec 4, 2014
  12. for_each_reflog_ent_reverse: fix newlines on block boundariesJeff King, Dec 5, 2014
  13. for_each_reflog_ent_reverse: turn leftover check into assertionJeff King, Dec 5, 2014
  14. Junio C HamanoDec 5, 2014
  15. Junio C HamanoDec 4, 2014

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.