maint.mk: check for [ as well as test
authorEric Blake <eblake@redhat.com>
Wed, 31 Mar 2010 21:33:55 +0000 (15:33 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 31 Mar 2010 21:33:55 +0000 (15:33 -0600)
A word on the regex: \<\[ never matches, so the match instead
looks for a leading space in that case.  Although configure.ac
should generally use test instead of [ (because the latter has
to be spelled [[ because of m4 processing), libvirt had a case
of the latter that would have been detected with this rule.

* top/maint.mk (sc_prohibit_test_minus_ao): Extend test.
Based on a libvirt report by Matthias Bolte.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
top/maint.mk

index 03d99e7..82263a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-03-31  Eric Blake  <eblake@redhat.com>
 
+       maint.mk: check for [ as well as test
+       * top/maint.mk (sc_prohibit_test_minus_ao): Extend test.
+       Based on a libvirt report by Matthias Bolte.
+
        gnumakefile: don't squelch _version output
        * top/GNUmakefile (_version): Create one-shot dependency rather
        than using $(shell) when version must be regenerated.
index e121eb8..8253e8b 100644 (file)
@@ -597,9 +597,10 @@ sc_prohibit_S_IS_definition:
 _ptm1 = use "test C1 && test C2", not "test C1 -''a C2"
 _ptm2 = use "test C1 || test C2", not "test C1 -''o C2"
 # Using test's -a and -o operators is not portable.
+# We prefer test over [, since the latter is spelled [[ in configure.ac.
 sc_prohibit_test_minus_ao:
-       @re='\<test .+ -[ao] '                                          \
-       msg='$(_ptm1); $(_ptm2)'                                                \
+       @re='(\<test| \[+) .+ -[ao] '                                   \
+       msg='$(_ptm1); $(_ptm2)'                                        \
          $(_prohibit_regexp)
 
 # Each program that uses proper_name_utf8 must link with one of the