From 91a936645ae0feb3cc9299ca069b1d57dd919747 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Thu, 24 Jan 2013 10:05:11 +0100
Subject: [PATCH 3/6] Avoid false positive with texi

Some texi file use gfdl with @c for comment instead of space.
Avoid false positive by allowing @c
---
 checks/cruft                                       |   32 ++++++++++----------
 .../debian/src/make-stds.texi                      |    7 +++++
 2 files changed, 23 insertions(+), 16 deletions(-)
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/make-stds.texi

diff --git a/checks/cruft b/checks/cruft
index 8368c1b..a5a521b 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -455,28 +455,28 @@ sub find_cruft {
                     if (!exists $licenseproblemhash{'gfdl-invariants'}) {
                         my $gfdlsections = $1;
                         # local space
-                        my $s = '(?:\s+|\@c)';
-                         # GFDL license, assume it is bad unless it
+                        my $s = '(?:\s|\@c)';
+                        # GFDL license, assume it is bad unless it
                         # explicitly states it has no "bad sections".
                         given($gfdlsections) {
-                            when(m/with \s+ (?:the\s+)? no \s+ Invariant \s+ Sections,?
-                                        \s+ (?:with\s+)? (?:the\s+)? no \s+ Front-Cover \s+ Texts,? \s+ and
-                                        \s+ (?:with\s+)? (?:the\s+)? no \s+ Back-Cover \s+ Texts/xis) {
+                            when(m/with $s+ (?:the$s+)? no $s+ Invariant $s+ Sections,?
+                                        $s+ (?:with$s+)? (?:the$s+)? no $s+ Front-Cover $s+ Texts,? $s+ and
+                                        $s+ (?:with$s+)? (?:the$s+)? no $s+ Back-Cover $s+ Texts/xiso) {
                                 # no invariant
                             }
-                            when(m/with \s+ the \s+ Invariant \s+ Sections \s+ being
-                                        \s+ (?:\@var\{|<var>)? LIST \s+ THEIR \s+TITLES (?:\}|<\/var>)? \s? ,?
-                                        \s+ with \s+ the \s+ Front-Cover \s+ Texts \s+ being
-                                        \s+ (?:\@var\{|<var>)? LIST (?:\}|<\/var>)? \s? ,?
-                                        \s+ and \s+ with \s+ the \s+ Back-Cover \s+ Texts \s+ being
-                                        \s+ (?:\@var\{|<var>)? LIST (?:\}|<\/var>)?/xis) {
+                            when(m/with $s+ the $s+ Invariant $s+ Sections $s+ being
+                                        $s+ (?:\@var\{|<var>)? LIST $s+ THEIR $s+TITLES (?:\}|<\/var>)? $s? ,?
+                                        $s+ with $s+ the $s+ Front-Cover $s+ Texts $s+ being
+                                        $s+ (?:\@var\{|<var>)? LIST (?:\}|<\/var>)? $s? ,?
+                                        $s+ and $s+ with $s+ the $s+ Back-Cover $s+ Texts $s+ being
+                                        $s+ (?:\@var\{|<var>)? LIST (?:\}|<\/var>)?/xiso) {
                                 # verbatim text of license is ok
                             } 
-                            when(m/\A \s* (?:(?:\,|\.|;)\s*)? version \s+ \d+(?:\.\d+)? \s+ 
-                                   (?:or \s+ any \s+ later \s+ version\s+)?
-                                   published \s+ by \s+ the \s+ Free \s+ Software \s+ Foundation \s*
-                                   (?:(?:\,|\.|;)\s*)? \z
-                                   /xis) {
+                            when(m/\A $s* (?:(?:\,|\.|;)$s*)? version $s+ \d+(?:\.\d+)? $s+ 
+                                   (?:or $s+ any $s+ later $s+ version $s+)?
+                                   published $s+ by $s+ the $s+ Free $s+ Software $s+ Foundation $s*
+                                   (?:(?:\,|\.|;)$s*)? \z
+                                   /xiso) {
                                 # empty text is ambiguous
                                 tag 'license-problem-gfdl-invariants-empty', $name;
                                 $licenseproblemhash{'gfdl-invariants'} = 1;
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/make-stds.texi b/t/tests/cruft-gfdl-invariants/debian/src/make-stds.texi
new file mode 100644
index 0000000..b5c2685
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/make-stds.texi
@@ -0,0 +1,7 @@
+@c Permission is granted to copy, distribute and/or modify this document
+@c under the terms of the GNU Free Documentation License, Version 1.1
+@c or any later version published by the Free Software Foundation;
+@c with no Invariant Sections, with no
+@c Front-Cover Texts, and with no Back-Cover Texts.
+@c A copy of the license is included in the section entitled ``GNU
+@c Free Documentation License''.
-- 
1.7.10.4

