From dec5f469ecc075f2572c949b53c576636b7273ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 20 May 2013 13:37:57 +0200
Subject: [PATCH] Fix #708957 when GFDL is used in template

Fix #708957 by allowing entities but only on well known files.
Indeed in other files, entities could be the phase of moon or even devil clauses.
---
 checks/cruft                                                  |    9 +++++++++
 .../kdoctools/customization/ru/entities/fdl-notice.docbook    |    6 ++++++
 2 files changed, 15 insertions(+)
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/oldfalsepositive/kdoctools/customization/ru/entities/fdl-notice.docbook

diff --git a/checks/cruft b/checks/cruft
index 67fc821..b6a69a3 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -528,6 +528,15 @@ sub find_cruft {
                                 tag 'license-problem-gfdl-invariants-empty', $name;
                                 $licenseproblemhash{'gfdl-invariants'} = 1;
                             }
+                            # fix #708957 about FDL entities in template
+                            when(m/with $s+ \&FDLInvariantSections;, $s+ with $s+ \&FDLFrontCoverText;, 
+                                        $s+ and $s+ with $s+ \&FDLBackCoverText;/xiso)
+                            {
+                                unless($name =~ m/\/customization\/[\w-]+\/entities\/[\w-]+\.docbook$/) {
+                                    tag 'license-problem-gfdl-invariants', $name;
+                                    $licenseproblemhash{'gfdl-invariants'} = 1;
+                                }
+                            }
                             default {
                                 tag 'license-problem-gfdl-invariants', $name;
                                 $licenseproblemhash{'gfdl-invariants'} = 1;
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/oldfalsepositive/kdoctools/customization/ru/entities/fdl-notice.docbook b/t/tests/cruft-gfdl-invariants/debian/src/oldfalsepositive/kdoctools/customization/ru/entities/fdl-notice.docbook
new file mode 100644
index 0000000..0168da6
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/oldfalsepositive/kdoctools/customization/ru/entities/fdl-notice.docbook
@@ -0,0 +1,6 @@
+<para>Permission is granted to copy, distribute and/or modify this
+document under the terms of the GNU Free Documentation License,
+Version 1.2 or any later version published by the Free Software
+Foundation; with &FDLInvariantSections;, with &FDLFrontCoverText;, and
+with &FDLBackCoverText;.  A copy of the license is included in <xref linkend="gnu-fdl"/>.</para>
+
-- 
1.7.10.4

