Package: debsums
Version: 2.0.48
Severity: wishlist
Tags: patch

I have made a small modification to debsums (modified version attached).  I 
have added the following option:

-x, --report-mismatches      report errors and print the md5sums mismatch

which corresponds to:

  if ($report)
  {
      warn "$self: changed file $root/$path (observed:$s expected:$sum (from 
$pack package)\n";
      return 2;
  }

For changed files, this will print both the expected MD5sum and the observed 
MD5sum as output.

-- System Information:
Debian Release: squeeze/sid
  APT prefers lucid-updates
  APT policy: (600, 'lucid-updates'), (600, 'lucid-security'), (600, 'lucid'), 
(400, 'lucid-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38.8-gg705 (SMP w/6 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages debsums depends on:
ii  debconf [debconf-2.0]  1.5.28ubuntu4     Debian configuration management sy
ii  perl                   5.10.1-8ubuntu2.1 Larry Wall's Practical Extraction 

debsums recommends no packages.

debsums suggests no packages.

-- debconf information:
  debsums/apt-autogen: true
--- /usr/bin/debsums    2010-01-01 06:35:05.000000000 -0800
+++ debsums.01.pl       2012-02-15 16:06:31.031145000 -0800
@@ -65,7 +65,7 @@
  -c, --changed                report changed files (implies -s)
  -l, --list-missing           list packages which don't have an md5sums file
  -s, --silent                 only report errors
- -m, --md5sums=FILE           read list of deb checksums from FILE
+ -x, --report-mismatches      report errors and print the md5sums mismatch
  -r, --root=DIR               root directory to check (default /)
  -d, --admindir=DIR           dpkg admin directory (default /var/lib/dpkg)
  -p, --deb-path=DIR[:DIR...]  search path for debs
@@ -86,6 +86,7 @@
     'c|changed'                => \my $changed,
     'l|list-missing'    => \my $missing,
     's|silent'         => \my $silent,
+    'x|report-mismatches'   => \my $report,
     'm|md5sums=s'      => \my $md5sums,
     'r|root=s'         => \my $root,
     'd|admindir=s'     => \my $admindir,
@@ -378,13 +379,13 @@
 
        if ($s eq $sum)
        {
-           printf "%-*s OK\n", $width, "$root/$path" unless $silent;
+           printf "%-*s OK\n", $width, "$root/$path" unless ($silent || 
$report);
            return 0;
        }
 
        if (is_replaced $pack, $path, $s)
        {
-           printf "%-*s REPLACED\n", $width - 6, "$root/$path" unless $silent;
+           printf "%-*s REPLACED\n", $width - 6, "$root/$path" unless ($silent 
|| $report);
            return 0;
        }
 
@@ -394,9 +395,15 @@
            return 2;
        }
 
+  if ($report)
+  {
+      warn "$self: changed file $root/$path (observed:$s expected:$sum) (from 
$pack package)\n";
+      return 2;
+  }
+
        if ($silent)
        {
-            warn "$self: changed file $root/$path (from $pack package)\n";
+      warn "$self: changed file $root/$path (from $pack package)\n";
        }
        else
        {

Reply via email to