summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-15 02:27:30 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-15 02:27:30 +0000
commit2ea9efd54150557e57e7784abeefaf45f089ff3f (patch)
tree865ae6f5af3ac7c79b0a270cb9d6e175ca68ca6c
parent8d81e65167fb806f33fa6512398f5c72c78299c7 (diff)
downloadportage-2ea9efd54150557e57e7784abeefaf45f089ff3f.tar.gz
portage-2ea9efd54150557e57e7784abeefaf45f089ff3f.tar.bz2
portage-2ea9efd54150557e57e7784abeefaf45f089ff3f.zip
Make dir_get_metadata() return early if the current user does
not have write access to /var/cache/edb. Thanks to Cardoe for reporting. svn path=/main/trunk/; revision=8502
-rw-r--r--pym/portage/getbinpkg.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
index f5390b9dd..87f205528 100644
--- a/pym/portage/getbinpkg.py
+++ b/pym/portage/getbinpkg.py
@@ -455,6 +455,8 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
else:
keepconnection = 1
+ cache_path = "/var/cache/edb"
+
if makepickle is None:
makepickle = "/var/cache/edb/metadata.idx.most_recent"
@@ -479,6 +481,11 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
if not metadata[baseurl].has_key("data"):
metadata[baseurl]["data"]={}
+ if not os.access(cache_path, os.W_OK):
+ sys.stderr.write("!!! Unable to write binary metadata to disk!\n")
+ sys.stderr.write("!!! Permission denied: '%s'\n" % cache_path)
+ return metadata[baseurl]["data"]
+
filelist = dir_get_list(baseurl, conn)
tbz2list = match_in_array(filelist, suffix=".tbz2")
metalist = match_in_array(filelist, prefix="metadata.idx")