# HG changeset patch # User Kevin Bullock # Date 2013-04-23 21:57:51 # Node ID 12f15e4b2ca0bf22ce5683f59f3919212ac11c73 # Parent 63dda3c3bb114150ea88b90eaccce8123b9e7d52 check-code: fix sed 'i' command rule newline matching The regular expression was meant to match cases where an 'i' command was not followed by precisely a '\' and then a newline; it failed to match the newline, so cases with a '\' but no newline would erroneously pass. diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -74,7 +74,7 @@ testpats = [ (r'/dev/u?random', "don't use entropy, use /dev/zero"), (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"), (r'^( *)\t', "don't use tabs to indent"), - (r'sed .*\'(\d+|/[^/]*/)i[^\\][^\n]', + (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)', "put a backslash-escaped newline after sed 'i' command"), ], # warnings