Re: [PATCH v4 2/6] t/lib-patch-mode.sh: fix ignored exit codes

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

 



On Tue, Dec 27 2022, Phillip Wood wrote:

> Hi Ævar
>
> On 19/12/2022 10:19, Ævar Arnfjörð Bjarmason wrote:
>> Fix code added in b319ef70a94 (Add a small patch-mode testing library,
>> 2009-08-13) to use &&-chaining.
>> This avoids losing both the exit code of a "git" and the "cat"
>> processes.
>> This fixes cases where we'd have e.g. missed memory leaks under
>> SANITIZE=leak, this code doesn't leak now as far as I can tell, but I
>> discovered it while looking at leaks in related code.
>> [...]   # verify_saved_state <path>
>> @@ -46,5 +50,6 @@ save_head () {
>>   }
>>     verify_saved_head () {
>> -	test "$(cat _head)" = "$(git rev-parse HEAD)"
>> +	git rev-parse HEAD >actual &&
>> +	test_cmp _head actual
>
> Aren't these two lines are re-implementing test_cmp_rev()?

It does --verify, and this does not.

Could we use it? Yes, but I wanted to narrowly focus on just fixing the
lost exit codes in this series. Once you start to untangle "save_head"
and "verify_saved_head" you'll see that whether we narrowly used a
helper here or not isn't the only thing we could improve.

But such an improvement would make use use --verify, and we'd then want
to use that "--verify" for the earlier saved_head too, etc.




[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