changeset 19083:12f15e4b2ca0 stable

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.
author Kevin Bullock <kbullock@ringworld.org>
date Tue, 23 Apr 2013 16:57:51 -0500
parents 63dda3c3bb11
children 70675d77fd4a
files contrib/check-code.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Mon Apr 22 18:00:59 2013 -0700
+++ b/contrib/check-code.py	Tue Apr 23 16:57:51 2013 -0500
@@ -74,7 +74,7 @@
     (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