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

Bug#711069: [lintian] patch



Package: lintian
Version: 2.5.13

patch here
From 798a031f470e459cc546653ea9023ac86199a251 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 29 Jul 2013 14:58:49 +0200
Subject: [PATCH] Check for typo like description: description : in field

Check for duplicated fieldname in field
---
 checks/control-file.desc                              |    8 ++++++++
 checks/control-file.pm                                |    4 ++++
 t/tests/control-file-general/debian/debian/control.in |   10 ++++++++++
 t/tests/control-file-general/desc                     |    1 +
 t/tests/control-file-general/tags                     |    3 ++-
 5 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/checks/control-file.desc b/checks/control-file.desc
index 6fb786d..9903063 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -36,6 +36,14 @@ Info: The field on this line of <tt>debian/control</tt> has whitespace
  in the syntax of Debian control files, but as Policy says, it is
  conventional to put a single space after the colon.
 
+Tag: debian-control-has-repeated-field-name-as-field
+Severity: normal
+Certainty: possible
+Ref: policy 5.1
+Info: The field on this line of <tt>debian/control</tt> has been 
+ repeated in the field description, like for instance
+ Maintainer: Maintainer: maintainer@mail.example.com. 
+
 Tag: binary-control-field-duplicates-source
 Severity: wishlist
 Certainty: certain
diff --git a/checks/control-file.pm b/checks/control-file.pm
index cf56840..ee985db 100644
--- a/checks/control-file.pm
+++ b/checks/control-file.pm
@@ -84,6 +84,10 @@ while (<$fd>) {
         unless (/^\S+: \S/ || /^\S+:$/) {
             tag 'debian-control-has-unusual-field-spacing', "line $.";
         }
+        # something like "Maintainer: Maintainer: bad field"
+        if (/^(\S+):\s*\1\s*:/) {
+            tag 'debian-control-has-repeated-field-name-as-field', "line $.";
+        }
     }
 }
 close($fd);
diff --git a/t/tests/control-file-general/debian/debian/control.in b/t/tests/control-file-general/debian/debian/control.in
index d99a5b2..dc5d694 100644
--- a/t/tests/control-file-general/debian/debian/control.in
+++ b/t/tests/control-file-general/debian/debian/control.in
@@ -72,6 +72,16 @@ Description: {$description} (four)
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.  It may
  be an empty package.
+ 
+Package: {$srcpkg}-5
+Section: {$section}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.  It may
+ be an empty package.
 
 Package: {$srcpkg}-udeb
 Section: debian-installer
diff --git a/t/tests/control-file-general/desc b/t/tests/control-file-general/desc
index 100880e..edde9fe 100644
--- a/t/tests/control-file-general/desc
+++ b/t/tests/control-file-general/desc
@@ -6,6 +6,7 @@ Test-For:
  binary-control-field-duplicates-source
  build-info-in-binary-control-file-section
  control-file-contains-dh_make-vcs-comment
+ debian-control-has-repeated-field-name-as-field
  duplicate-long-description
  duplicate-short-description
  missing-separator-between-items
diff --git a/t/tests/control-file-general/tags b/t/tests/control-file-general/tags
index 506cc2e..b9ca609 100644
--- a/t/tests/control-file-general/tags
+++ b/t/tests/control-file-general/tags
@@ -3,10 +3,11 @@ E: control-file-general source: missing-separator-between-items in control-file-
 E: control-file-general source: obsolete-relation-form-in-source in control-file-general-1 breaks: libsqlite3-0 (< 3.6.12)
 E: control-file-general source: obsolete-relation-form-in-source in source build-depends-indep: perl (> 5.8)
 I: control-file-general source: binary-control-field-duplicates-source field "maintainer" in package control-file-general
-I: control-file-general source: duplicate-long-description control-file-general control-file-general-1 control-file-general-2 control-file-general-3 control-file-general-4
+I: control-file-general source: duplicate-long-description control-file-general control-file-general-1 control-file-general-2 control-file-general-3 control-file-general-4 control-file-general-5
 I: control-file-general source: duplicate-short-description control-file-general control-file-general-1
 I: control-file-general source: xs-vcs-header-in-debian-control xs-vcs-svn
 W: control-file-general source: control-file-contains-dh_make-vcs-comment
+W: control-file-general source: debian-control-has-repeated-field-name-as-field line 80
 W: control-file-general source: no-section-field-for-source
 W: control-file-general source: package-depends-on-itself control-file-general depends
 W: control-file-general source: stronger-dependency-implies-weaker control-file-general depends -> recommends foo
-- 
1.7.10.4


Reply to: