From e0be348e4d6ebd660c9558bcee50f648491cfef6 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 26 Oct 2017 13:50:38 +0900 Subject: coccinelle: grep Options and Requires fields more precisely Currently, the required version for badzero.cocci is picked up from its "Comments:" line since it contains the word "Requires". Surprisingly, ld-version.sh can extract the version number from the string "Requires Coccinelle version 1.0.0-rc20 or later", but this expectation is fragile. Fix the .cocci file. I removed "-rc20" because ld-version.sh cannot handle it. Make the coccicheck script to see exact patterns for "Options:" and "Requires:" in order to avoid accidental matching to what just happens to appear in comment lines. Signed-off-by: Masahiro Yamada Acked-by: Julia Lawall Acked-by: Nicolas Palix --- scripts/coccicheck | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/coccicheck') diff --git a/scripts/coccicheck b/scripts/coccicheck index 864b17e05e63..97f28f0f9498 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -168,8 +168,8 @@ OPTIONS="$OPTIONS $SPFLAGS" coccinelle () { COCCI="$1" - OPT=`grep "Option" $COCCI | cut -d':' -f2` - REQ=`grep "Requires" $COCCI | cut -d':' -f2 | sed "s| ||"` + OPT=`grep "Options:" $COCCI | cut -d':' -f2` + REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"` REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh) if [ "$REQ_NUM" != "0" ] ; then if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then -- cgit v1.2.3-59-g8ed1b