From 2ea9efd54150557e57e7784abeefaf45f089ff3f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 15 Nov 2007 02:27:30 +0000 Subject: [PATCH] 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 --- pym/portage/getbinpkg.py | 7 +++++++ 1 file changed, 7 insertions(+) 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") -- 2.26.2