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

[lintian] 03/04: Check for inconsistencies between "Files" and Checksums-* sections in .changes files. (Closes: #658542)



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository lintian.

commit a5aa7a0878781ec64e5fbfbfd278c04b32edc0be
Author: Chris Lamb <lamby@debian.org>
Date:   Mon Jan 29 19:07:08 2018 +0000

    Check for inconsistencies between "Files" and Checksums-* sections in .changes files. (Closes: #658542)
---
 checks/changes-file.desc |  7 +++++++
 checks/changes-file.pm   | 11 +++++++++++
 debian/changelog         |  2 ++
 3 files changed, 20 insertions(+)

diff --git a/checks/changes-file.desc b/checks/changes-file.desc
index b7a11e6..13b347b 100644
--- a/checks/changes-file.desc
+++ b/checks/changes-file.desc
@@ -80,6 +80,13 @@ Info: The actual checksum does not match what's listed in the
  <tt>.changes</tt> file.
 Ref: policy 5.6.21, policy 5.6.24
 
+Tag: checksum-count-mismatch-in-changes-file
+Severity: serious
+Certainty: certain
+Info: The number of checksums <tt>.changes</tt> file for the
+ specified algorithm does not match the number of files.
+Ref: policy 5.6.21, policy 5.6.24
+
 Tag: bad-section-in-changes-file
 Severity: important
 Certainty: certain
diff --git a/checks/changes-file.pm b/checks/changes-file.pm
index 5f37ad2..35a82d4 100644
--- a/checks/changes-file.pm
+++ b/checks/changes-file.pm
@@ -195,6 +195,7 @@ sub run {
 
     my $files = $info->files;
     my $path = readlink($info->lab_data_path('changes'));
+    my %num_checksums;
     $path =~ s#/[^/]+$##;
     foreach my $file (keys %$files) {
         my $file_info = $files->{$file};
@@ -239,6 +240,7 @@ sub run {
             next unless exists $file_info->{checksums}{$alg};
 
             my $real_checksum = get_file_checksum($alg, $filename);
+            $num_checksums{$alg}++;
 
             if ($real_checksum ne $file_info->{checksums}{$alg}{sum}) {
                 tag 'checksum-mismatch-in-changes-file', $alg, $file;
@@ -246,6 +248,15 @@ sub run {
         }
     }
 
+    # Check that we have a consistent number of checksums and files
+    foreach my $alg (keys %num_checksums) {
+        my $seen = $num_checksums{$alg};
+        my $expected = keys %{$files};
+        tag 'checksum-count-mismatch-in-changes-file',
+          "$seen $alg checksums != $expected files"
+          if $seen != $expected;
+    }
+
     return;
 }
 
diff --git a/debian/changelog b/debian/changelog
index 5a4a67b..e240d0a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,8 @@ lintian (2.5.73) UNRELEASED; urgency=medium
       file-size-mismatch-in-changes-file and
       checksum-mismatch-in-changes-file tags were not being checked if a
       package contained an upstream signature.
+    + [CL] Check for inconsistencies between "Files" and Checksums-*
+      sections in .changes files.  (Closes: #658542)
   * checks/fields.{desc,pm}:
     + [CL] Add a pedantic warning for co-maintained packages that are not
       managed in a revision control system.  (Closes: #884497)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: