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

Bug#757583: patch fixing this issue



tag 757583 patch
thanks

Hi,

please find attached a patch which fixes this issue.

cheers, josch
From a29c798e31977055c6c0b740f1e1bb0376709ff7 Mon Sep 17 00:00:00 2001
From: josch <j.schauer@email.de>
Date: Mon, 11 Aug 2014 09:13:04 +0200
Subject: [PATCH] warn if pipe symbol is used as an OR in dep-5 license

---
 checks/source-copyright.desc                             |  9 +++++++++
 checks/source-copyright.pm                               |  8 ++++++++
 .../debian/debian/copyright                              | 16 ++++++++++++++++
 t/tests/source-copyright-illegal-pipe-as-or/desc         |  6 ++++++
 t/tests/source-copyright-illegal-pipe-as-or/tags         |  2 ++
 5 files changed, 41 insertions(+)
 create mode 100644 t/tests/source-copyright-illegal-pipe-as-or/debian/debian/copyright
 create mode 100644 t/tests/source-copyright-illegal-pipe-as-or/desc
 create mode 100644 t/tests/source-copyright-illegal-pipe-as-or/tags

diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
index 921e7b9..bca74cc 100644
--- a/checks/source-copyright.desc
+++ b/checks/source-copyright.desc
@@ -205,3 +205,12 @@ Info: The paragraph has a "License" and a "Copyright" field, but no
  Lintian will attempt to guess what you intended and continue based on
  its guess.  If the guess is wrong, you may see spurious tags related
  to this paragraph.
+
+Tag: pipe-symbol-used-as-license-disjunction
+Severity: normal
+Certainty: possible
+Ref: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Info: In contrast to package dependencies, the pipe symbol or vertical
+ bar does not indicate a logical disjunction or OR-relationship
+ between two license short names. Instead, the keyword "or" between
+ two license names indicates the dual licensing.
diff --git a/checks/source-copyright.pm b/checks/source-copyright.pm
index 6b9a0c5..e99ea02 100644
--- a/checks/source-copyright.pm
+++ b/checks/source-copyright.pm
@@ -277,6 +277,10 @@ sub _parse_dep5 {
             my ($found_license, $full_license, $short_license, @short_licenses)
               = parse_license($license,$current_line);
             # Standalone license paragraph
+            if (defined($short_license) and $short_license =~ /\s++\|\s++/) {
+                tag 'pipe-symbol-used-as-license-disjunction', $short_license,
+                  "(paragraph at line $current_line)";
+            }
             if(not defined($full_license)) {
                 tag 'missing-license-text-in-dep5-copyright', $license,
                   "(paragraph at line $current_line)";
@@ -299,6 +303,10 @@ sub _parse_dep5 {
 
             my ($found_license, $full_license, $short_license, @short_licenses)
               = parse_license($license,$current_line);
+            if (defined($short_license) and $short_license =~ /\s++\|\s++/) {
+                tag 'pipe-symbol-used-as-license-disjunction', $short_license,
+                  "(paragraph at line $current_line)";
+            }
             if ($found_license) {
                 for (@short_licenses) {
                     $short_licenses_seen{$short_license} = $i;
diff --git a/t/tests/source-copyright-illegal-pipe-as-or/debian/debian/copyright b/t/tests/source-copyright-illegal-pipe-as-or/debian/debian/copyright
new file mode 100644
index 0000000..acbd7b3
--- /dev/null
+++ b/t/tests/source-copyright-illegal-pipe-as-or/debian/debian/copyright
@@ -0,0 +1,16 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Doohickey
+Upstream-Contact: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+
+Files: *
+Copyright: 2014, somebody1
+License: this | that
+
+Files: debian/*
+Copyright: 2014, somebody1
+License: this|that
+ this is a valid license short name
+
+License: this | that
+ should be "this or that"
diff --git a/t/tests/source-copyright-illegal-pipe-as-or/desc b/t/tests/source-copyright-illegal-pipe-as-or/desc
new file mode 100644
index 0000000..43669d1
--- /dev/null
+++ b/t/tests/source-copyright-illegal-pipe-as-or/desc
@@ -0,0 +1,6 @@
+Testname: source-copyright-illegal-pipe-as-or
+Sequence: 6000
+Version: 1.0
+Description: Test for the pipe symbol being used as an "or"
+Test-For:
+ pipe-symbol-used-as-license-disjunction
diff --git a/t/tests/source-copyright-illegal-pipe-as-or/tags b/t/tests/source-copyright-illegal-pipe-as-or/tags
new file mode 100644
index 0000000..cace0c7
--- /dev/null
+++ b/t/tests/source-copyright-illegal-pipe-as-or/tags
@@ -0,0 +1,2 @@
+W: source-copyright-illegal-pipe-as-or source: pipe-symbol-used-as-license-disjunction this | that (paragraph at line 15)
+W: source-copyright-illegal-pipe-as-or source: pipe-symbol-used-as-license-disjunction this | that (paragraph at line 6)
-- 
2.0.1


Reply to: