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

[SCM] Debian package checker branch, master, updated. 2.5.6-16-g35a61c6



The following commit has been merged in the master branch:
commit 35a61c67e45e08d53de4710135225b4e78ce60ce
Author: Jakub Wilk <jwilk@debian.org>
Date:   Sun Mar 18 20:48:29 2012 +0100

    Util: Consider duplicate fields a syntax error
    
    Changes to the original patch:
     - Drop two tags that are now redundant
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/control-file b/checks/control-file
index 2dccf73..987b632 100644
--- a/checks/control-file
+++ b/checks/control-file
@@ -50,8 +50,7 @@ if ($line) {
     tag 'debian-control-file-uses-obsolete-national-encoding', "at line $line"
 }
 
-# Check that each field is only used once:
-my $seen_fields = {};
+# Nag about dh_make Vcs comment only once
 my $seen_vcs_comment = 0;
 open (CONTROL, '<', $dcontrol)
     or fail "Couldn't read debfiles/control: $!";
@@ -67,16 +66,9 @@ while (<CONTROL>) {
 
     next if /^\#/;
 
-    #Reset seen_fields if we enter a new section:
-    $seen_fields = {} if $_ eq '';
-
     #line with field:
     if (/^(\S+):/) {
         my $field = lc ($1);
-        if ($seen_fields->{$field}) {
-            tag 'debian-control-with-duplicate-fields', "$field: $$seen_fields{$field}, $.";
-        }
-        $seen_fields->{$field} = $.;
         if ($field =~ /^xs-vcs-/) {
             my $base = $field;
             $base =~ s/^xs-//;
diff --git a/checks/control-file.desc b/checks/control-file.desc
index f902151..d8e7f81 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -27,14 +27,6 @@ Info: The control file has a Build-Depends, Build-Depends-Indep,
  section.  These specify source package relationships, and should be in
  the source section of the control file.
 
-Tag: debian-control-with-duplicate-fields
-Severity: serious
-Certainty: certain
-Ref: policy 5.1
-Info: One of the paragraphs of your debian/control contains the same
- field more than once. This can lead to unexpected behaviour in
- <tt>dpkg</tt> and <tt>apt</tt>.
-
 Tag: debian-control-has-unusual-field-spacing
 Severity: pedantic
 Certainty: certain
diff --git a/checks/debconf b/checks/debconf
index 2ba3072..7669ceb 100644
--- a/checks/debconf
+++ b/checks/debconf
@@ -177,36 +177,6 @@ if ($seenconfig and not -x "$cdir/config") {
     tag 'debconf-config-not-executable';
 }
 
-# First check that templates look valid
-if ($seentemplates) {
-    open(TMPL, '<', "$cdir/templates")
-        or fail("Can't open control/templates: $!");
-    local $/ = "\n\n";
-    while (<TMPL>) {
-        chomp;
-        my %fields = ();
-        my $name = 'unknown';
-
-        foreach my $line (split "\n", $_) {
-            if ($line =~ s/^([-_.A-Za-z0-9]+):\s*(.+)//) {
-                $fields{$1}++;
-                $name = $2 if ($1 eq 'Template');
-            }
-        }
-
-        foreach (keys %fields) {
-            if ($fields{$_} > 1) {
-                local $/ = "\n";
-                tag 'duplicate-fields-in-templates', "$name $_";
-                #  Templates file is corrupted, no need to report
-                #  further errors
-                $seentemplates = '';
-            }
-        }
-    }
-    close TMPL;
-}
-
 # Lots of template checks.
 
 my @templates = ();
diff --git a/checks/debconf.desc b/checks/debconf.desc
index b6f4edf..79254e7 100644
--- a/checks/debconf.desc
+++ b/checks/debconf.desc
@@ -19,13 +19,6 @@ Info: Packages using debconf in their preinst script must pre-depend
  almost always already installed, this is normally better than depending
  on it and falling back to a different configuration system.
 
-Tag: duplicate-fields-in-templates
-Severity: important
-Certainty: certain
-Info: A template contains two identical fields (with identical values or
- not). This is either an error in this template, or two templates are
- not properly separated by a lone newline.
-
 Tag: unknown-field-in-templates
 Severity: important
 Certainty: certain
diff --git a/data/output/ftp-master-fatal b/data/output/ftp-master-fatal
index 046ca63..dcb7b6e 100644
--- a/data/output/ftp-master-fatal
+++ b/data/output/ftp-master-fatal
@@ -21,7 +21,6 @@ copyright-file-is-symlink
 copyright-refers-to-incorrect-directory
 copyright-refers-to-old-directory
 debian-control-file-uses-obsolete-national-encoding
-debian-control-with-duplicate-fields
 debian-rules-missing-required-target
 debian-rules-not-a-makefile
 description-is-dh_make-template
diff --git a/debian/changelog b/debian/changelog
index 6d47b03..cbb0071 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,7 +4,9 @@ lintian (2.5.7) UNRELEASED; urgency=low
     + Removed:
       - ancient-dpkg-long-filenames-check
       - ancient-dpkg-predepends-check
+      - debian-control-with-duplicate-fields
       - doc-base-file-references-usr-doc
+      - duplicate-fields-in-templates
       - manpage-for-non-x11-binary-in-wrong-directory
       - manpage-for-x11-binary-in-wrong-directory
       - obsolete-field
@@ -19,6 +21,10 @@ lintian (2.5.7) UNRELEASED; urgency=low
 
   * checks/copyright-file{,.desc}:
     + [NT] Remove old tags.
+  * checks/control-file{,.desc}:
+    + [NT] Remove redundant tag.
+  * checks/debconf{,.desc}:
+    + [NT] Remove redundant tag.
   * checks/fields{,.desc}:
     + [NT] Remove old tags.
   * checks/files{,.desc}:
@@ -44,6 +50,10 @@ lintian (2.5.7) UNRELEASED; urgency=low
     + [NT] Lazily evaluate the data file.
   * lib/Lintian/Data.pm:
     + [NT] Lazily load data files.
+  * lib/Util.pm:
+    + [JW] Consider duplicate fields a syntax error in dctrl files.
+      Previously, duplicate fields were silently ignored (except
+      when a separate tag would check for it).  (Closes: #664061)
 
  -- Niels Thykier <niels@thykier.net>  Wed, 14 Mar 2012 22:55:46 +0100
 
diff --git a/lib/Util.pm b/lib/Util.pm
index baff01c..618afbd 100644
--- a/lib/Util.pm
+++ b/lib/Util.pm
@@ -134,6 +134,11 @@ sub _parse_dpkg_control_iterative {
             # immediately before or after the value and is ignored there.
             my ($tag,$value) = (lc $1,$2);
             $value =~ s/\s+$//;
+            if (exists $section->{$tag}) {
+                # Policy: A paragraph must not contain more than one instance
+                # of a particular field name.
+                die "syntax error at line $.: Duplicate field $tag.\n";
+            }
             $section->{$tag} = $value;
 
             $last_tag = $tag;
diff --git a/profiles/debian/ftp-master-auto-reject.profile b/profiles/debian/ftp-master-auto-reject.profile
index f1bc6bc..13f5ef4 100644
--- a/profiles/debian/ftp-master-auto-reject.profile
+++ b/profiles/debian/ftp-master-auto-reject.profile
@@ -12,11 +12,10 @@ Enable-Tags: FSSTND-dir-in-usr, FSSTND-dir-in-var, arch-dependent-file-in-usr-sh
  copyright-file-is-symlink, copyright-refers-to-incorrect-directory,
  copyright-refers-to-old-directory,
  debian-control-file-uses-obsolete-national-encoding,
- debian-control-with-duplicate-fields, debian-rules-missing-required-target,
- debian-rules-not-a-makefile, description-is-dh_make-template,
- description-synopsis-is-empty, dir-or-file-in-mnt, dir-or-file-in-opt,
- dir-or-file-in-srv, dir-or-file-in-tmp, dir-or-file-in-var-www,
- embedded-library, extended-description-is-empty,
+ debian-rules-missing-required-target, debian-rules-not-a-makefile,
+ description-is-dh_make-template, description-synopsis-is-empty,
+ dir-or-file-in-mnt, dir-or-file-in-opt, dir-or-file-in-srv, dir-or-file-in-tmp,
+ dir-or-file-in-var-www, embedded-library, extended-description-is-empty,
  file-in-etc-not-marked-as-conffile, file-in-usr-marked-as-conffile,
  forbidden-postrm-interpreter, install-info-used-in-maintainer-script,
  library-in-debug-or-profile-should-not-be-stripped, magic-arch-in-arch-list,
@@ -47,12 +46,11 @@ Tags: FSSTND-dir-in-usr, FSSTND-dir-in-var, bad-package-name, bad-relation, bad-
  copyright-file-is-symlink, copyright-refers-to-incorrect-directory,
  copyright-refers-to-old-directory,
  debian-control-file-uses-obsolete-national-encoding,
- debian-control-with-duplicate-fields, debian-rules-missing-required-target,
- debian-rules-not-a-makefile, description-is-dh_make-template,
- description-synopsis-is-empty, dir-or-file-in-mnt, dir-or-file-in-opt,
- dir-or-file-in-srv, dir-or-file-in-tmp, extended-description-is-empty,
- file-in-etc-not-marked-as-conffile, file-in-usr-marked-as-conffile,
- forbidden-postrm-interpreter,
+ debian-rules-missing-required-target, debian-rules-not-a-makefile,
+ description-is-dh_make-template, description-synopsis-is-empty,
+ dir-or-file-in-mnt, dir-or-file-in-opt, dir-or-file-in-srv, dir-or-file-in-tmp,
+ extended-description-is-empty, file-in-etc-not-marked-as-conffile,
+ file-in-usr-marked-as-conffile, forbidden-postrm-interpreter,
  library-in-debug-or-profile-should-not-be-stripped, magic-arch-in-arch-list,
  maintainer-address-is-on-localhost, maintainer-address-malformed,
  maintainer-address-missing, maintainer-name-missing,
diff --git a/t/COVERAGE b/t/COVERAGE
index 5b2d04c..ad504b4 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,5 +1,5 @@
-Last generated 2012-03-15
-Coverage: 784/947 (82.79%), w. legacy tests: 889/947 (93.88%)
+Last generated 2012-03-18
+Coverage: 783/945 (82.86%), w. legacy tests: 888/945 (93.97%)
 
 The following tags are not tested by the test suite:
 
@@ -15,7 +15,6 @@ deb-format tar-errors-from-data
 
 debconf boolean-template-has-bogus-default
 debconf debconf-is-not-a-registry
-debconf duplicate-fields-in-templates
 debconf duplicate-long-description-in-template
 debconf empty-translated-choices
 debconf isdefault-flag-is-deprecated
diff --git a/t/source/control-file-duplicate-field/desc b/t/source/control-file-duplicate-field/desc
index 8828bbe..69f241e 100644
--- a/t/source/control-file-duplicate-field/desc
+++ b/t/source/control-file-duplicate-field/desc
@@ -2,4 +2,4 @@ Testname: control-file-duplicate-field
 Sequence: 6000
 Version: 1.0
 Description: Test for d/control containing duplicate fields
-Test-For: debian-control-with-duplicate-fields
+Test-For: syntax-error-in-control-file
diff --git a/t/source/control-file-duplicate-field/tags b/t/source/control-file-duplicate-field/tags
index fd2374b..a224b88 100644
--- a/t/source/control-file-duplicate-field/tags
+++ b/t/source/control-file-duplicate-field/tags
@@ -1 +1 @@
-E: control-file-duplicate-field source: debian-control-with-duplicate-fields depends: 10, 11
+E: control-file-duplicate-field source: syntax-error-in-control-file debian/control: syntax error at line 11: Duplicate field depends.

-- 
Debian package checker


Reply to: