diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-11-13 01:50:06 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-11-13 01:50:06 +0000 |
commit | 9293df039dbdccb15857fe0f8dccad3d202f3423 (patch) | |
tree | c7d9d91fd85ca6bdddf5825f35c2117913b4bc77 | |
parent | a522121744194d1e951d21a2af1afd959a97bb5d (diff) | |
download | portage-9293df039dbdccb15857fe0f8dccad3d202f3423.tar.gz portage-9293df039dbdccb15857fe0f8dccad3d202f3423.tar.bz2 portage-9293df039dbdccb15857fe0f8dccad3d202f3423.zip |
Always return early from NewsManager.updateItems() if self.unread_path can't
be created.
svn path=/main/trunk/; revision=11868
-rw-r--r-- | pym/portage/news.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/pym/portage/news.py b/pym/portage/news.py index 6c0712d3a..332e05dc1 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -16,7 +16,7 @@ from portage.util import apply_permissions, ensure_dirs, grabfile, \ from portage.data import portage_gid from portage.dep import isvalidatom from portage.locks import lockfile, unlockfile -from portage.exception import OperationNotPermitted +from portage.exception import OperationNotPermitted, PermissionDenied class NewsManager(object): """ @@ -50,15 +50,6 @@ class NewsManager(object): profile_path = profile_path[len(profiles_base):] self._profile_path = profile_path - # Ensure that the unread path exists and is writable. - dirmode = 02070 - modemask = 02 - try: - ensure_dirs(self.unread_path, mode=dirmode, - mask=modemask, gid=portage_gid) - except OperationNotPermitted: - pass - def updateItems(self, repoid): """ Figure out which news items from NEWS_PATH are both unread and relevant to @@ -66,6 +57,17 @@ class NewsManager(object): items into the news.repoid.unread file. """ + # Ensure that the unread path exists and is writable. + dirmode = 00700 + modemask = 022 + try: + ensure_dirs(self.unread_path, mode=dirmode, mask=modemask) + except (OperationNotPermitted, PermissionDenied): + return + + if not os.access(self.unread_path, os.W_OK): + return + repos = self.portdb.getRepositories() if repoid not in repos: raise ValueError("Invalid repoID: %s" % repoid) |