From: Zac Medico Date: Sat, 15 Nov 2008 22:17:01 +0000 (-0000) Subject: Make NewsManager.updateItems() and getUnreadItems() return early if X-Git-Tag: v2.1.6_rc1~57 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fcf54e8c78dd053e4b946c252b0d478ded4e783c;p=portage.git Make NewsManager.updateItems() and getUnreadItems() return early if PermissionDenied errors are encountered when attempting to read the skip or unread files. svn path=/main/branches/2.1.6/; revision=11957 --- 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)