[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 11:10:20 -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 02:45 AM, Jim Meyering wrote:
> I tried the latest gnulib in coreutils and saw these two
> false positives:
>
> src/copy.c:730: test below (*wp++ == 0) would read some
> uninitialized bytes
> src/stty.c:1339: test would have been (ts_lines > 64k || ts_cols >
> 64k || ts_cols == 0).
> maint.mk: use "test x = x", not "test x == x"
> make: *** [sc_prohibit_test_double_equal] Error 1
>
> +
> + maint.mk: tighten "test a == b" check
> + * top/maint.mk (sc_prohibit_test_double_equal): Restrict this
> + test to files that contain something like #!/bin/sh.
> + Without this, coreutils would get two false positives in
> + the comments of C source files.
Except that this weakens the test so that it no longer detects a real
bug in libivrt - a C source file that generated the equivalent of a
system() call where the embedded shell script used test.
src/nwfilter/nwfilter_ebiptables_driver.c:653:
"if [ \"${res}\" == \"\" ]; then "
> +
> 2010-11-12 Eric Blake <address@hidden>
>
> bootstrap: fix typo in previous attempt
> diff --git a/top/maint.mk b/top/maint.mk
> index d51944b..65c2f80 100644
> --- a/top/maint.mk
> +++ b/top/maint.mk
> @@ -820,6 +820,7 @@ sc_prohibit_test_minus_ao:
> # Avoid a test bashism.
> sc_prohibit_test_double_equal:
> @prohibit='(\<test| \[+) .+ == ' \
> + containing='^#! */bin/sh' \
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?
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature