[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#698667: marked as done ([lintian] Improve gfdl detection)



Your message dated Tue, 12 Feb 2013 23:03:44 +0100
with message-id <511ABC40.8070706@thykier.net>
and subject line Re: Bug#698667: Gfdl improve
has caused the Debian Bug report #698667,
regarding [lintian] Improve gfdl detection
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
698667: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698667
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: lintian
Version: 2.5.10.3
Severity: normal

Please found some patch to improve gfdl detection
From c52ab1461d430b14601348d697fe02fca31af205 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 21 Jan 2013 21:42:16 +0100
Subject: [PATCH 1/5] Simplify cruft test of license by using for/when
 structure

Simplify the cruft test by using a case like structure
---
 checks/cruft |   50 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 20 deletions(-)

diff --git a/checks/cruft b/checks/cruft
index 6f2e45e..9e7ed6f 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -25,6 +25,7 @@
 package Lintian::cruft;
 use strict;
 use warnings;
+use v5.14;
 
 # Half of the size used in the "sliding window" for detecting bad
 # licenses like GFDL with invariant sections.
@@ -432,38 +433,47 @@ sub find_cruft {
             push @queue, $window;
             $block =  join '', @queue;
 
-            # json evil license
-            if (!exists $licenseproblemhash{'json-evil'}) {
-                if ($block =~ m/Software\s+shall\s+be\s+used\s+for\s+Good\s*,?\s*not\s+Evil/is) {
-                    tag 'license-problem-json-evil', $name;
-                    $licenseproblemhash{'json-evil'} = 1;
+            for ($block) {
+                # json evil license
+                when (m/Software\s+shall\s+be\s+used\s+for\s+Good\s*,?\s*not\s+Evil/is) {
+                    if(!exists $licenseproblemhash{'json-evil'}) {
+                         tag 'license-problem-json-evil', $name;
+                         $licenseproblemhash{'json-evil'} = 1;
+                    }
                 }
-            }
-            if (!exists $licenseproblemhash{'gfdl-invariants'}) {
                 # check GFDL block - The ".{0,1024}"-part in the regex
                 # will contain the "no invariants etc."  part if
                 # it is a good use of the license.  We include it
                 # here to ensure that we do not emit a false positive
                 # if the "redeeming" part is in the next block.
                 #
-                # See cruft-gfdl-fp-sliding-win for the test case.
-                if ($block =~m/GNU \s+ Free \s+ Documentation \s+ License (.{0,1024})
-                               A \s+ copy \s+ of \s+ the \s+ license \s+ is \s+ included/xis) {
-                    # GFDL license, assume it is bad unless it
-                    # explicitly states it has no "bad sections".
-                    my $gfdlsections = $1;
-                    unless ($gfdlsections =~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) {
-                        # license gfdl text verbatim is ok
-                        unless ($gfdlsections =~m/with \s+ the \s+ Invariant \s+ Sections \s+ being
+                # See cruft-gfdl-fp-sliding-win for the test case
+                when(m/GNU \s+ Free \s+ Documentation \s+ License (.{0,1024})
+                         A \s+ copy \s+ of \s+ the \s+ license \s+ is \s+ included/xis) {
+                    if (!exists $licenseproblemhash{'gfdl-invariants'}) {
+                        my $gfdlsections = $1;
+                        # local space
+                        my $s = '(?:\s+|\@c)';
+                         # GFDL license, assume it is bad unless it
+                        # explicitly states it has no "bad sections".
+                        for($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) {
+                                # 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) {
-                            tag 'license-problem-gfdl-invariants', $name;
-                            $licenseproblemhash{'gfdl-invariants'} = 1;
+                                # verbatim text of license is ok
+                            }
+                            default {
+                                tag 'license-problem-gfdl-invariants', $name;
+                                $licenseproblemhash{'gfdl-invariants'} = 1;
+                            }
                         }
                     }
                 }
-- 
1.7.10.4

From 9751cf4000e22d39df47b736d172cf4a08a3ff22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 21 Jan 2013 22:15:29 +0100
Subject: [PATCH 2/5] Detect empty gfdl statement about invariant sections.

gfdl ask to explicitly mark that you have not invariant section by writing
text like this:
"with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts."

Some author instead use empty text. Detect this usage.
---
 checks/cruft                                           |    5 +++++
 checks/cruft.desc                                      |   14 ++++++++++++++
 t/tests/cruft-gfdl-invariants/debian/src/empty.texi    |    5 +++++
 t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi |    7 +++++++
 t/tests/cruft-gfdl-invariants/tags                     |    2 ++
 5 files changed, 33 insertions(+)
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/empty.texi
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi

diff --git a/checks/cruft b/checks/cruft
index 9e7ed6f..53206e1 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -469,6 +469,11 @@ sub find_cruft {
                                         \s+ and \s+ with \s+ the \s+ Back-Cover \s+ Texts \s+ being
                                         \s+ (?:\@var\{|<var>)? LIST (?:\}|<\/var>)?/xis) {
                                 # verbatim text of license is ok
+                            } 
+                            when(m/^[\.;,\s\r\n]*$/is) {
+                                # empty text is ambiguous
+                                tag 'license-problem-gfdl-invariants-empty', $name;
+                                $licenseproblemhash{'gfdl-invariants'} = 1;
                             }
                             default {
                                 tag 'license-problem-gfdl-invariants', $name;
diff --git a/checks/cruft.desc b/checks/cruft.desc
index b184f9f..9ac7e0f 100644
--- a/checks/cruft.desc
+++ b/checks/cruft.desc
@@ -497,3 +497,17 @@ Info: The given source file is licensed under GFDL with invariant
  suitable for main.
 Ref: http://wiki.debian.org/qa.debian.org/gfdlinvariant,
  http://www.debian.org/vote/2006/vote_001
+
+Tag: license-problem-gfdl-invariants-empty
+Severity: important
+Certainty: possible
+Info: The given source file is licensed under GFDL, but without any 
+ precision about the presence of invariant sections, front-cover or 
+ back-cover text.
+ .
+ GFDL license explicitly ask you to document this non presence.
+ .
+ GFDL with invariant sections, front-cover or back-cover texts are not
+ suitable for main. 
+Ref: http://wiki.debian.org/qa.debian.org/gfdlinvariant,
+ http://www.debian.org/vote/2006/vote_001
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/empty.texi b/t/tests/cruft-gfdl-invariants/debian/src/empty.texi
new file mode 100644
index 0000000..8e87b5f
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/empty.texi
@@ -0,0 +1,5 @@
+Permission is granted to copy, distribute and/or modify this
+document under the terms of the GNU Free Documentation License,
+version 1.3 or any later version published by the Free Software
+Foundation. A copy of the license is included in the
+section entitled "GNU Free Documentation License".
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi b/t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi
new file mode 100644
index 0000000..7ad0640
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/emptybis.texi
@@ -0,0 +1,7 @@
+Permission is granted to copy, distribute and/or modify this
+document under the terms of the GNU Free Documentation License,
+version 1.3 or any later version published by the Free Software
+Foundation.
+
+A copy of the license is included in the
+section entitled "GNU Free Documentation License".
diff --git a/t/tests/cruft-gfdl-invariants/tags b/t/tests/cruft-gfdl-invariants/tags
index dc071c3..e216ff6 100644
--- a/t/tests/cruft-gfdl-invariants/tags
+++ b/t/tests/cruft-gfdl-invariants/tags
@@ -1,3 +1,5 @@
+E: cruft-gfdl-invariants source: license-problem-gfdl-invariants src/empty.texi
+E: cruft-gfdl-invariants source: license-problem-gfdl-invariants src/emptybis.texi
 E: cruft-gfdl-invariants source: license-problem-gfdl-invariants src/frontback.html
 E: cruft-gfdl-invariants source: license-problem-gfdl-invariants src/frontback.texi
 E: cruft-gfdl-invariants source: license-problem-gfdl-invariants src/invariant.txt
-- 
1.7.10.4

From a75186673c27b322e91b6a6383dca34721110d60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 21 Jan 2013 22:45:30 +0100
Subject: [PATCH 3/5] 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                                       |   22 ++++++++++----------
 .../debian/src/make-stds.texi                      |    7 +++++++
 2 files changed, 18 insertions(+), 11 deletions(-)
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/make-stds.texi

diff --git a/checks/cruft b/checks/cruft
index 53206e1..5b467e6 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -453,21 +453,21 @@ 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".
                         for($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/xis) {
                                 # 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>)?/xis) {
                                 # verbatim text of license is ok
                             } 
                             when(m/^[\.;,\s\r\n]*$/is) {
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

From 058ab5a2991db39851cfe821c49c105e3e9571d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 21 Jan 2013 22:51:03 +0100
Subject: [PATCH 4/5] Simplify grouping by using ?'name'

?'name' is better for documentation than $1
---
 checks/cruft |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/checks/cruft b/checks/cruft
index 5b467e6..c032b45 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -448,15 +448,14 @@ sub find_cruft {
                 # if the "redeeming" part is in the next block.
                 #
                 # See cruft-gfdl-fp-sliding-win for the test case
-                when(m/GNU \s+ Free \s+ Documentation \s+ License (.{0,1024})
+                when(m/GNU \s+ Free \s+ Documentation \s+ License (?'gfdlsection'.{0,1024})
                          A \s+ copy \s+ of \s+ the \s+ license \s+ is \s+ included/xis) {
                     if (!exists $licenseproblemhash{'gfdl-invariants'}) {
-                        my $gfdlsections = $1;
                         # local space
                         my $s = '(?:\s|\@c)';
                         # GFDL license, assume it is bad unless it
                         # explicitly states it has no "bad sections".
-                        for($gfdlsections) {
+                        for($+{gfdlsection}) {
                             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) {
-- 
1.7.10.4

From 27155452b181402aa1c7e466ae9d929d7b519a57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 21 Jan 2013 23:17:32 +0100
Subject: [PATCH 5/5] Avoid a false positive with tex comments

Tex comments % are allowed in the gfdl.
---
 checks/cruft                                                 |    2 +-
 t/tests/cruft-gfdl-invariants/debian/src/gfdltexcomments.tex |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 t/tests/cruft-gfdl-invariants/debian/src/gfdltexcomments.tex

diff --git a/checks/cruft b/checks/cruft
index c032b45..3781b50 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -452,7 +452,7 @@ sub find_cruft {
                          A \s+ copy \s+ of \s+ the \s+ license \s+ is \s+ included/xis) {
                     if (!exists $licenseproblemhash{'gfdl-invariants'}) {
                         # local space
-                        my $s = '(?:\s|\@c)';
+                        my $s = '(?:\s|\@c|%)';
                         # GFDL license, assume it is bad unless it
                         # explicitly states it has no "bad sections".
                         for($+{gfdlsection}) {
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/gfdltexcomments.tex b/t/tests/cruft-gfdl-invariants/debian/src/gfdltexcomments.tex
new file mode 100644
index 0000000..00e496c
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/gfdltexcomments.tex
@@ -0,0 +1,7 @@
+% Permission is granted to copy, distribute and/or modify this document
+% under the terms of the GNU Free Documentation License, Version 1.1 or
+% any later version published by the Free Software Foundation; with no
+% Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+% Texts.  A copy of the license is included in the section entitled
+% ``GNU Free Documentation License.''
+%
-- 
1.7.10.4


--- End Message ---
--- Begin Message ---
... and remember to close it, because it does not apply to any released
version of Lintian.  Sorry for the extra mail(s).

~Niels

--- End Message ---

Reply to: