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 <[email protected]>
>
> 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 [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
