From 3a43b4392d5c23bc049a5ac925cdda981c751178 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 24 Jan 2013 12:01:28 -0800 Subject: [PATCH] RepoConfigLoader: raise PermissionDenied --- pym/portage/repository/config.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 8a110e990..9a6c15d12 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -6,6 +6,7 @@ from __future__ import unicode_literals import io import logging import warnings +import stat import sys import re @@ -23,6 +24,7 @@ from portage.const import (MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH, REPO_NAME_LOC, USER_CONFIG_PATH) from portage.eapi import eapi_allows_directories_on_profile_level_and_repository_level from portage.env.loaders import KeyValuePairFileLoader +from portage.exception import PermissionDenied from portage.util import (normalize_path, read_corresponding_eapi_file, shlex_split, stack_lists, writemsg, writemsg_level) from portage.localization import _ @@ -373,7 +375,14 @@ class RepoConfigLoader(object): #overlay priority is negative because we want them to be looked before any other repo base_priority = 0 for ov in overlays: - if os.path.isdir(ov): + try: + st = os.stat(ov) + except OSError as e: + st = None + if e.errno == PermissionDenied.errno: + raise PermissionDenied("stat('%s')" % ov) + + if st is not None and stat.S_ISDIR(st.st_mode): repo_opts = default_repo_opts.copy() repo_opts['location'] = ov repo = RepoConfig(None, repo_opts) -- 2.26.2