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

Bug#664061: lintian: check for duplicate fields in control files



Package: lintian
Version: 2.5.6
Severity: wishlist

Please see the attached patch.

Note that the patch breaks the control-file-duplicate-field test. I'm not sure what to with it: the test used to emit debian-control-with-duplicate-fields, now it also emits syntax-error-in-control-file. Perhaps the former tag could be removed: it isn't currently triggered by any package in the archive.

--
Jakub Wilk
# HG changeset patch
# Parent 6764299ceeba43e704f5c274810e7565fe396682

diff --git a/lib/Util.pm b/lib/Util.pm
--- a/lib/Util.pm
+++ b/lib/Util.pm
@@ -134,6 +134,11 @@
             # 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;

Reply to: