[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] maint.mk: tighten "test a == b" check
From: |
Eric Blake |
Subject: |
Re: [PATCH] maint.mk: tighten "test a == b" check |
Date: |
Sat, 13 Nov 2010 13:46:42 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6 |
On 11/13/2010 11:31 AM, Paolo Bonzini wrote:
> On 11/13/2010 07:10 PM, Eric Blake wrote:
>> Maybe a compromise would be to revert this, but to tighten the prohibit
>> regex:
>>
>> prohibit='(\<test| \[+) ("[^"]*"|[^ ]+) == '
>>
>> which misses out on both false positives in coreutils, but still detects
>> the libvirt bug?
>
> Or the shell syntax checks' $containing could be set with a makefile
> variable (defaulting to ^#! */bin/sh but overridable by libvirt).
Hmm; that particular libvirt file includes the string #!/bin/bash, but
also part of a string constant being written to a temporary shell script
file. So allowing an override of the prohibit string would do the
trick; but for now, it's even easier to just change it.
(Double-hmm - that means that libvirt file is technically immune to the
very problem I'm trying to detect, since it requires bash and bash
supports test ==; but I really want to convert that file to work with
any /bin/sh rather than requiring bash).
Here's what I'll push:
From 085dcf3490d16a18f8f2d41c46c856ddaa7a2e79 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Sat, 13 Nov 2010 13:44:07 -0700
Subject: [PATCH] maintainer-makefile: cover a few more files
* top/maint.mk (sc_prohibit_test_double_equal): Also cover shell
scripts generated within C files, for libvirt.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
top/maint.mk | 2 +-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fe84ead..97cebc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-13 Eric Blake <address@hidden>
+
+ maintainer-makefile: cover a few more files
+ * top/maint.mk (sc_prohibit_test_double_equal): Also cover shell
+ scripts generated within C files, for libvirt.
+
2010-11-13 Bruno Haible <address@hidden>
unistr/u8-mbtouc: Improve handling of ill-formed UTF-8 input.
diff --git a/top/maint.mk b/top/maint.mk
index 65c2f80..2c1be85 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -820,7 +820,7 @@ sc_prohibit_test_minus_ao:
# Avoid a test bashism.
sc_prohibit_test_double_equal:
@prohibit='(\<test| \[+) .+ == ' \
- containing='^#! */bin/sh' \
+ containing='#! */bin/[a-z]*sh' \
halt='use "test x = x", not "test x =''= x"' \
$(_sc_search_regexp)
--
1.7.3.2
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature