[debsums] 99/184: add --ignore-persmissions option for use by reportbug (Closes: #536576)

Axel Beckert abe at deuxchevaux.org
Mon Mar 2 21:21:22 UTC 2015


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

abe pushed a commit to branch master
in repository debsums.

commit 11d21c761b6e71bb9a740923af49ae771ed583f3
Author: Ryan Niebur <ryanryan52 at gmail.com>
Date:   Sun Aug 2 17:07:32 2009 -0700

    add --ignore-persmissions option for use by reportbug (Closes: #536576)
---
 debian/changelog |  4 +++-
 debsums.in       | 37 ++++++++++++++++++++++++++++++++-----
 2 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ae052f0..2260500 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,8 +9,10 @@ debsums (2.0.47) UNRELEASED; urgency=low
   * document the solution to bug #74033
   * document the possible outcomes (Closes: #469774)
   * patch from sgran to fix rmtree usage (Closes: #487317)
+  * add --ignore-persmissions option for use by reportbug (Closes:
+    #536576)
 
- -- Ryan Niebur <ryanryan52 at gmail.com>  Sun, 02 Aug 2009 15:58:11 -0700
+ -- Ryan Niebur <ryanryan52 at gmail.com>  Sun, 02 Aug 2009 17:03:23 -0700
 
 debsums (2.0.46) unstable; urgency=low
 
diff --git a/debsums.in b/debsums.in
index 86b2275..1385322 100755
--- a/debsums.in
+++ b/debsums.in
@@ -15,6 +15,7 @@ use Fcntl qw/O_RDONLY O_NONBLOCK O_NOATIME/;
 use Getopt::Long qw/:config bundling/;
 use Digest::MD5;
 use constant ELF_MAGIC => "\177ELF";
+use Errno;
 
 (my $self = $0) =~ s!.*/!!;
 my $version = <<EOT;
@@ -68,11 +69,24 @@ GetOptions (
     'generate=s'	=> \$gen_opt,
     'locale-purge!'	=> \my $localepurge,
     'prelink!'		=> \my $prelink,
+    'ignore-permissions' => \my $ignore_permissions,
     g			=> sub { $gen_opt = 'missing' },
     help		=> sub { print $help; exit },
     version		=> sub { print $version; exit },
 ) or die "Try '$self --help' for more information.\n";
 
+sub can_ignore {
+  return $!{EACCES} && $ignore_permissions;
+}
+
+sub warn_or_die {
+  if(can_ignore()) {
+    warn $_[0];
+  } else {
+    die $_[0];
+  }
+}
+
 $root ||= '';
 $admindir ||= '/var/lib/dpkg';
 my $DPKG = $root . $admindir;
@@ -183,12 +197,15 @@ for (`/usr/sbin/dpkg-divert --list`)
 my %debsum;
 if ($md5sums)
 {
-    open F, $md5sums or die "$self: can't open sums file '$md5sums' ($!)\n";
+    open F, $md5sums or warn_or_die "$self: can't open sums file '$md5sums' ($!)\n";
+    if(fileno(F)) {
     while (<F>)
     {
 	my ($sum, $deb) = split;
 	$debsum{$deb} = $sum;
     }
+    close F;
+    }
 }
 
 my $digest = Digest::MD5->new;
@@ -262,7 +279,11 @@ sub is_replaced
 		and !$locales{$1};
 
 	    warn "$self: can't open $pack file $root/$path ($!)\n";
-	    return 2;
+            if(can_ignore()) {
+              return 0;
+            } else {
+              return 2;
+            }
 	}
 
 	unless (-f F)
@@ -458,9 +479,11 @@ for (@ARGV)
 	{
 	    if (exists $debsum{$deb})
 	    {
-		open F, $deb or die "$self: can't open $deb ($!)\n";
+		open F, $deb or warn_or_die "$self: can't open $deb ($!)\n";
+                if(fileno(F)) {
 		$digest->addfile(\*F);
 		close F;
+                }
 
 		unless ($digest->hexdigest eq $debsum{$deb})
 		{
@@ -522,9 +545,11 @@ for (@ARGV)
 
 	    find sub {
 		return if -l or ! -f;
-		open F, $_ or die "$self: can't open $_ ($!)\n";
+		open F, $_ or warn_or_die "$self: can't open $_ ($!)\n";
+                if(fileno(F)) {
 		$digest->addfile(\*F);
 		close F;
+                }
 		my $md5 = $digest->hexdigest;
 		my $path = substr $File::Find::name, $skip;
 		if (delete $conf{$path})
@@ -561,7 +586,8 @@ for (@ARGV)
 
     unless ($config)
     {
-	open SUMS, $sums or die "$self: can't open $sums ($!)\n";
+	open SUMS, $sums or warn_or_die "$self: can't open $sums ($!)\n";
+        if(fileno(SUMS)) {
 	while (<SUMS>)
 	{
 	    chomp;
@@ -578,6 +604,7 @@ for (@ARGV)
 	}
 
 	close SUMS;
+      }
     }
 
     next unless ($all or $config) and %$conffiles;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/debsums.git



More information about the Pkg-perl-cvs-commits mailing list