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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nicolas Pitre <nico@xxxxxxx> writes:

> 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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux