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

Re: [PATCH] make verify-pack a bit more useful with bad packs

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 2, 2008, 06:27 UTC
Message-ID
<7vskvw8i77.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.1.10.0805291716470.23581@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
Show 22 quoted lines
> When a pack gets corrupted, its SHA1 checksum will fail.  However, this
> is more useful to let the test go on in order to find the actual 
> problem location than only complain about the SHA1 mismatch and
> bail out.
> ...
>  	/* Verify SHA1 sum of the index file */
>  	SHA1_Init(&ctx);
>  	SHA1_Update(&ctx, index_base, (unsigned int)(index_size - 20));
>  	SHA1_Final(sha1, &ctx);
>  	if (hashcmp(sha1, index_base + index_size - 20))
> -		ret = error("Packfile index for %s SHA1 mismatch",
> +		err = error("Packfile index for %s SHA1 mismatch",
>  			    p->pack_name);
>  
> -	if (!ret) {
> -		/* Verify pack file */
> -		struct pack_window *w_curs = NULL;
> -		ret = verify_packfile(p, &w_curs);
> -		unuse_pack(&w_curs);
> -	}
> +	/* Verify pack file */
> +	err = verify_packfile(p, &w_curs);

This overwrites the index SHA-1 mismatch you detected earlier. An obvious fix-up would be to:

	err |= verify_packfile(p, &w_curs);
Will be in 1.5.6-rc1.
Previous: Nicolas Pitre
Message 2 of 2 in “make verify-pack a bit more useful with bad packs”
  1. make verify-pack a bit more useful with bad packsNicolas Pitre, May 29, 2008
  2. Junio C HamanoJun 2, 2008

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.