[2/2] devtools: fix forbidden token

Message ID 20200706080022.3887-2-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Headers
Series [1/2] devtools: fix filename in forbidden token check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

David Marchand July 6, 2020, 8 a.m. UTC
  An expression with a space is split by the awk script resulting in
false positive for any patch matching any of the two part of the
expression.
Fix this by using [[:space:]].

Fixes: 43e73483a4b8 ("devtools: forbid variable declaration inside for")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon July 6, 2020, 8:56 a.m. UTC | #1
06/07/2020 10:00, David Marchand:
> An expression with a space is split by the awk script resulting in
> false positive for any patch matching any of the two part of the
> expression.
> Fix this by using [[:space:]].
> 
> Fixes: 43e73483a4b8 ("devtools: forbid variable declaration inside for")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Applied, thanks
  

Patch

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 27ab1252b7..58021aa5dd 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -71,7 +71,7 @@  check_forbidden_additions() { # <patch>
 
 	# forbid variable declaration inside "for" loop
 	awk -v FOLDERS='.' \
-		-v EXPRESSIONS='for *\\((char|u?int|unsigned|s?size_t)' \
+		-v EXPRESSIONS='for[[:space:]]*\\((char|u?int|unsigned|s?size_t)' \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Declaring a variable inside for()' \
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \