Re: [PATCH v7] read-cache: force_verify_index_checksum
- From
- Jeff Hostetler <git@jeffhostetler.com>
- Date
- Apr 24, 2017, 18:39 UTC
- Message-ID
- <8bde0b54-c0f6-364d-1f08-ce5207eb6c86@jeffhostetler.com>
- In-Reply-To
- <870a8a36-fc6c-6b07-d09e-eec8a9f46a5c@kdbg.org>
On 4/24/2017 1:26 PM, Johannes Sixt wrote:
Show 19 quoted lines
> Am 14.04.2017 um 22:32 schrieb git@jeffhostetler.com: >> diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh >> index 33a51c9..677e15a 100755 >> --- a/t/t1450-fsck.sh >> +++ b/t/t1450-fsck.sh >> @@ -689,4 +689,17 @@ test_expect_success 'bogus head does not >> fallback to all heads' ' >> ! grep $blob out >> ' >> >> +test_expect_success 'detect corrupt index file in fsck' ' >> + cp .git/index .git/index.backup && >> + test_when_finished "mv .git/index.backup .git/index" && >> + echo zzzzzzzz >zzzzzzzz && >> + git add zzzzzzzz && >> + sed -e "s/zzzzzzzz/yyyyyyyy/" .git/index >.git/index.yyy && > > sed on a binary file? Sooner or later we are going to run into > portability issues.
In v5 of this patch series I used "perl" and it was suggested that I use "sed" instead. It doesn't matter to me which we use. My testing showed that it was safe, but that was only Linux.
Does the mailing list have a preference for this ?
Show 9 quoted lines
> > >> + mv .git/index.yyy .git/index && >> + # Confirm that fsck detects invalid checksum >> + test_must_fail git fsck --cache && > > You should ensure that this failure is really because of an invalid > checksum. The failure could also be due to an extra LF at the end that > sed inserted, no?
I suppose we could, but I'm tempted to wait on that for now.
Jeff