From 949608fb1efab569db8c10fed4e7d2f6793bc144 Mon Sep 17 00:00:00 2001 From: lxoliva Date: Fri, 22 Jan 2010 07:19:43 +0000 Subject: [PATCH] Fix matching of false positives adjusting matchlen to RLENGTH + 1 ??? Add more verbosity to python and awk scripts. git-svn-id: http://www.fsfla.org/svn/fsfla/software/linux-libre/scripts@5866 559672b5-ba27-0410-b829-e8f1faed8b1b --- deblob-check-awk | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/deblob-check-awk b/deblob-check-awk index 45d6d79d3d71..1f6837e007ec 100755 --- a/deblob-check-awk +++ b/deblob-check-awk @@ -3339,6 +3339,7 @@ for line in sys.stdin: what = match.lastgroup if what == 'cblob': + if verbose: print 'match is a blob context' pend = match.end() p = match.start() + 1 match = rxc.search (s, p) @@ -3348,8 +3349,10 @@ for line in sys.stdin: assert blob_p or what == 'falsepos' if blob_p: + if verbose: print 'match is a blob' blobs += 1 else: + if verbose: print 'match is a false positive' falses += 1 assert match.end(what) == match.end() @@ -3517,23 +3520,28 @@ BEGIN { firstmatchstart = RSTART + p - 1; for (;;) { matchstart = RSTART + p - 1; - matchlen = RLENGTH; + matchlen = RLENGTH + 1; if (verbose) print "found match", matchstart, matchlen; + if (verbose > 1) + print substr (s, matchstart, matchlen); if (match (substr (s, matchstart, matchlen), /^($falsepos)$/) == 1) { + if (verbose) print "match is a false positive"; blob_p = 0; falses++; } else if (match (substr (s, matchstart, matchlen), /^($cblob)$/) == 1) { + if (verbose) print "match is a blob context"; pend = p + matchlen; p = matchstart + 1; if (verbose) print "search after cblob starting at", p; - match (substr (s, p, matchlen), /^($falsepos)|^($cblob)|[^\n]*($blob)/); + match (substr (s, p, matchlen - 1), /^($falsepos)|^($cblob)|[^\n]*($blob)/); continue; } else { - # Match again, to skip + if (verbose) print "match is a blob"; + # Match again, to skip the leading non-blob characters. match (substr (s, matchstart), /$blob/); matchstart = RSTART + matchstart - 1; - matchlen = RLENGTH; + matchlen = RLENGTH + 1; blob_p = 1; blobs++; } -- 2.31.1