From 6788e80a70b6c012bfed3665d73dfbb9778fd806 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 15 Nov 2008 22:16:27 +0000 Subject: [PATCH] Make NewsManager.updateItems() and getUnreadItems() return early if PermissionDenied errors are encountered when attempting to read the skip or unread files. svn path=/main/trunk/; revision=11956 --- pym/portage/news.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pym/portage/news.py b/pym/portage/news.py index aa979dabd..90dd3a065 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -100,10 +100,13 @@ class NewsManager(object): unread_filename = self._unread_filename(repoid) unread_lock = lockfile(unread_filename, wantnewlockfile=1) try: - unread = set(grabfile(unread_filename)) - unread_orig = unread.copy() - skip = set(grabfile(skip_filename)) - skip_orig = skip.copy() + try: + unread = set(grabfile(unread_filename)) + unread_orig = unread.copy() + skip = set(grabfile(skip_filename)) + skip_orig = skip.copy() + except PermissionDenied: + return updates = [] for itemid in news: @@ -156,7 +159,10 @@ class NewsManager(object): except (InvalidLocation, OperationNotPermitted, PermissionDenied): return 0 try: - return len(grabfile(unread_filename)) + try: + return len(grabfile(unread_filename)) + except PermissionDenied: + return 0 finally: if unread_lock: unlockfile(unread_lock) -- 2.26.2