[Apt-listbugs-commits] [apt-listbugs] 01/04: add file access error handling in aptcleanup
Francesco Poli
frx-guest at moszumanska.debian.org
Mon Jun 30 20:08:26 UTC 2014
This is an automated email from the git hooks/post-receive script.
frx-guest pushed a commit to branch master
in repository apt-listbugs.
commit 1d711bffd977ffb2ae0f22134c41044cde9f55df
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date: Thu Jun 26 23:09:17 2014 +0200
add file access error handling in aptcleanup
---
aptcleanup | 16 ++++++++++++++--
debian/changelog | 3 +++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/aptcleanup b/aptcleanup
index acc79f1..4aae7e4 100755
--- a/aptcleanup
+++ b/aptcleanup
@@ -4,7 +4,7 @@
#
# Copyright (C) 2004 Masato Taruishi <taru at debian.org>
# Copyright (C) 2007 Jean Lepropre <jlepropre at gmail.com>
-# Copyright (C) 2008-2013 Francesco Poli <invernomuto at paranoici.org>
+# Copyright (C) 2008-2014 Francesco Poli <invernomuto at paranoici.org>
# Copyright (C) 2009 Ryan Niebur <ryan at debian.org>
#
# This program is free software; you can redistribute it and/or modify
@@ -37,7 +37,19 @@ APTCACHE = "/usr/bin/apt-cache"
LISTBUGS = "/usr/sbin/apt-listbugs"
# read APT preferences
-p = Debian::AptPreferences.new
+pref_file = "/etc/apt/preferences"
+begin
+ p = Debian::AptPreferences.new
+rescue Errno::ENOENT
+ $stderr.puts sprintf("Cannot find %s: exiting!", pref_file) if $DEBUG
+ exit 0
+rescue Errno::EACCES
+ $stderr.puts "E: " + sprintf("Cannot read from %s", pref_file)
+ exit 1
+rescue
+ $stderr.puts "E: " + "#{$!}"
+ exit 1
+end
pinned_pkg_keys = []
buggy_pkg_keys = []
diff --git a/debian/changelog b/debian/changelog
index 8539aff..9b93372 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,9 @@ apt-listbugs (0.1.14) UNRELEASED; urgency=medium
instance with the command "killall -USR1 apt-listbugs" (Closes: #273565)
* added a warning about pinning: when /etc/apt/preferences cannot be
written to, apt-listbugs warns the user, rather than crashing
+ * enhanced aptcleanup:
+ - added file access error handling for cases where /etc/apt/preferences
+ does not exist or is not readable
-- Francesco Poli (wintermute) <invernomuto at paranoici.org> Sun, 11 May 2014 16:45:18 +0200
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/apt-listbugs/apt-listbugs.git
More information about the Apt-listbugs-commits
mailing list