Re: [PATCH v4 2/2] interpret-trailers: add option for in-place editing

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

 



On Thu, Jan 14, 2016 at 3:45 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Tobias Klauser <tklauser@xxxxxxxxxx> writes:
>> diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh
>> @@ -326,6 +326,46 @@ test_expect_success 'with complex patch, args and --trim-empty' '
>> +test_expect_success POSIXPERM,SANITY "in-place editing doesn't clobber original file on error" '

I think POSIXPERM is all you need for this case; SANITY doesn't buy
you anything, if I understand correctly.

>> +     cat basic_message >message &&
>> +     chmod -r message &&
>> +     test_must_fail git interpret-trailers --trailer "Reviewed-by: Alice" --in-place message &&
>> +     chmod +r message &&
>> +     test_cmp message basic_message
>> +'
>
> If for some reason interpret-trailers fails to fail, this would
> leave an unreadable 'message' in the trash directory.  Maybe no
> other tests that come after this one want to be able to read the
> contents of the file right now, but this is an accident waiting to
> happen:
>
>         cat basic_message >message &&
> +       test_when_finished "chmod +r message" &&
>         chmod -r message &&
>         test_must_fail ... &&
>         chmod +r message &&

Don't forget to remove this (now unnecessary) "chmod +r" once you've
added the 'test_when_finished "chmod +r"'.

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