[libvirt] [PATCH 2/2] maint: update syntax-check rule to also catch test's -o operator

Eric Blake eblake at redhat.com
Thu Mar 25 21:34:49 UTC 2010


On 03/25/2010 02:22 AM, Jim Meyering wrote:
>> -# Using test's -a operator is not portable.
>> -sc_prohibit_test_minus_a:
>> +# Using test's -a and -o operators is not portable.
>> +sc_prohibit_test_minus_ao:
>>  	@re='\<test .+ -[a] '						\
>>  	msg='use "test C1 && test C2, not "test C1 -''a C2"'		\
>>  	  $(_prohibit_regexp)
>> +	@re='\<test .+ -[o] '						\
>> +	msg='use "test C1 || test C2, not "test C1 -''o C2"'		\
>> +	  $(_prohibit_regexp)
> 
> I actually wrote a separate target before I saw you'd done it.  Seeing
> yours, I realize that both tests do belong in the same rule, but would
> prefer the efficiency of combining the searches, so that we don't make
> two passes through all sources, when one will do.  Then the only trick is
> to produce a combined diagnostic.  Maybe like this (thought the resulting
> line is too long -- for a diagnostic it's not a big deal).

Agreed, since the diagnostic never prints on a successful run :)

> 
> _m1 = use "test C1 && test C2, not "test C1 -''a C2"
> _m2 = use "test C1 || test C2, not "test C1 -''o C2"
> 
> sc_prohibit_test_minus_ao:
>    	@re='\<test .+ -[ao] '						\
>    	msg='$(_m1); $(_m2)'						\
>    	  $(_prohibit_regexp)

I like this change.  ACK to your tweaks to my patch, and looking forward
to the push.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100325/ffff13af/attachment-0001.sig>


More information about the libvir-list mailing list