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

Re: [PATCH 3/4] fsck: check rev-index position values

From
Derrick Stolee <derrickstolee@github.com>
Date
Apr 18, 2023, 14:32 UTC
Message-ID
<e29e6584-709f-d172-e73a-88a2027a9283@github.com>
In-Reply-To
<xmqq1qkijhho.fsf@gitster.g>
On 4/17/2023 6:01 PM, Junio C Hamano wrote:
Show 19 quoted lines
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>>  	if (!hashfile_checksum_valid((const unsigned char *)p->revindex_map, p->revindex_size)) {
>>  		error(_("invalid checksum"));
>> -		return -1;
>> +		res = -1;
>>  	}
>>  
>> -	return 0;
>> +	/* This may fail due to a broken .idx. */
>> +	if (create_pack_revindex_in_memory(p))
>> +		return res;
> 
> Here, if the revindex file itself is self consistent, res would
> still be 0, so we will end up silently returning.  Is the idea that
> while whatever causes in-memory revindex fail to be computed is a
> concern from the point of view of the repository's health, it would
> be caught elsewhere as a problem for the <pack,idx> pair we are
> seeing here?

This is something I noticed during a test suite run, where the .idx was corrupt, so the .rev file could not be checked. In this situation, we are not using the .rev file for anything since Git processes would fail to lookup objects in the associated packfile.

In this case, we have no way to validate the rest of the .rev file's contents, but at least we checked its header and checksum, which is the best we can hope to do in this case.

Thanks, -Stolee

Previous: Junio C HamanoNext: Taylor Blau
Message 14 of 19 in “git fsck: check pack rev-index files”
  1. 0/4 git fsck: check pack rev-index filesDerrick Stolee via GitGitGadget, Apr 17, 2023
  2. 1/4 fsck: create scaffolding for rev-index checksDerrick Stolee via GitGitGadget, Apr 17, 2023
  3. Taylor BlauApr 17, 2023
  4. 2/4 fsck: check rev-index checksumsDerrick Stolee via GitGitGadget, Apr 17, 2023
  5. Junio C HamanoApr 17, 2023
  6. Derrick StoleeApr 18, 2023
  7. Taylor BlauApr 17, 2023
  8. Derrick StoleeApr 18, 2023
  9. Taylor BlauApr 18, 2023
  10. Derrick StoleeApr 18, 2023
  11. Taylor BlauApr 18, 2023
  12. 3/4 fsck: check rev-index position valuesDerrick Stolee via GitGitGadget, Apr 17, 2023
  13. Junio C HamanoApr 17, 2023
  14. Derrick StoleeApr 18, 2023
  15. Taylor BlauApr 17, 2023
  16. 4/4 fsck: validate .rev file headerDerrick Stolee via GitGitGadget, Apr 17, 2023
  17. Junio C HamanoApr 17, 2023
  18. Taylor BlauApr 18, 2023
  19. Junio C HamanoApr 18, 2023

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.