Re: [PATCH v7] read-cache: force_verify_index_checksum

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

 



Jeff Hostetler <git@xxxxxxxxxxxxxxxxx> writes:

>>> +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 ?

Instead of munging pathnames z* to y*, I'd prefer to see the actual
checksum bytes at the end replaced in the index file.  After all
that is what this test really cares about, and it ensures that the
failure detected is due to checksum mismatch.

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



[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]