[Apt-listbugs-commits] [SCM] apt-listbugs development tree branch, master, updated. apt-listbugs/0.1.5-25-g6d98afc
Francesco Poli (wintermute)
invernomuto at paranoici.org
Sat Dec 24 17:53:59 UTC 2011
The following commit has been merged in the master branch:
commit 6d98afcaa03b49372e1bf458e1abc15a01c5d1d4
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date: Sat Dec 24 18:24:40 2011 +0100
enhance robustness on ignore_bugs file reading
diff --git a/debian/changelog b/debian/changelog
index 04a6b2c..b88ad61 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,8 +17,11 @@ apt-listbugs (0.1.6) UNRELEASED; urgency=low
* added more assertions to the first test suite
* enhanced the (theoretical) correctness of the code to check whether a
bug is present in a package version
+ * enhanced robustness: if an ignore_bugs file is not readable, do not exit
+ with error, issue a warning instead, and go on without taking that file
+ into account
- -- Francesco Poli (wintermute) <invernomuto at paranoici.org> Sat, 10 Dec 2011 16:24:57 +0100
+ -- Francesco Poli (wintermute) <invernomuto at paranoici.org> Sat, 24 Dec 2011 00:07:15 +0100
apt-listbugs (0.1.5) unstable; urgency=low
diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index b6b1187..5902bab 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -272,17 +272,23 @@ class IgnoreBugs < Array
@@path_mutex[path] = Mutex.new if @@path_mutex[path] == nil
if FileTest.exist?(path)
- open(path).each { |bug|
- if /\s*#/ =~ bug
- next
- end
- if /\s*(\S+)/ =~ bug
- self << $1
- end
- }
+ begin
+ open(path).each { |bug|
+ if /\s*#/ =~ bug
+ next
+ end
+ if /\s*(\S+)/ =~ bug
+ self << $1
+ end
+ }
+ rescue Errno::EACCES
+ # read-access is not possible, warn the user that the
+ # file won't be taken into account
+ $stderr.puts sprintf(_("W: Cannot read from %s"), @path)
+ end
end
- @gavewarning = nil
+ @gavewritewarning = nil
end
def add(entry, write=true)
@@ -293,10 +299,11 @@ class IgnoreBugs < Array
file.puts entry
}
rescue Errno::EACCES
- # write-access is not possible, ignore it for now.
- if @gavewarning.nil?
- $stderr.puts _("W: Cannot write to bug ignore list file")
- @gavewarning = true
+ # write-access is not possible, warn the user that the
+ # file won't be updated
+ if @gavewritewarning.nil?
+ $stderr.puts sprintf(_("W: Cannot write to %s"), @path)
+ @gavewritewarning = true
end
end
}
--
apt-listbugs development tree
More information about the Apt-listbugs-commits
mailing list