From: Zac Medico Date: Tue, 20 Nov 2007 23:59:51 +0000 (-0000) Subject: Make dir_get_metadata() return early if the current user does X-Git-Tag: v2.1.4~263 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f41104f3be7de9abdb061d96f09fc2d512286a8c;p=portage.git Make dir_get_metadata() return early if the current user does not have write access to /var/cache/edb. Thanks to Cardoe for reporting. (trunk r8502) svn path=/main/branches/2.1.2/; revision=8561 --- diff --git a/pym/getbinpkg.py b/pym/getbinpkg.py index f8529d79e..b57da2ca1 100644 --- a/pym/getbinpkg.py +++ b/pym/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" @@ -482,6 +484,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")