This check was meant to test if the user has accidentally restricted access to the /etc/portage/savedconfig directory. There are a few problems:
1. We don't actually need read access on the directory. We really need the execute bit set so that we can access files within the directory. 2. There may be permissions issues on subdirectories, and we would fail to detect them. 3. There is no easy way to distingish between EACCES and ENOENT using shell commands. We get an exit status of 1 from [[ -r ${path} ]] if there is a permissions problem or if some component of the path does not exist. This makes resolving problem 2 difficult without using a more robust language with direct access to errno. Instead of trying to detect a permissions problem, just output a warning telling the user to check permissions if we cannot find a config file. Bug: https://bugs.gentoo.org/289168 Bug: https://bugs.gentoo.org/814995 Signed-off-by: Mike Gilbert <flop...@gentoo.org> --- eclass/savedconfig.eclass | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass index e90a9b618d6..c4fd0c492f4 100644 --- a/eclass/savedconfig.eclass +++ b/eclass/savedconfig.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: savedconfig.eclass @@ -146,14 +146,10 @@ restore_config() { treecopy . "${dest}" || die "Failed to restore ${found} to $1" popd > /dev/null else - # maybe the user is screwing around with perms they shouldnt #289168 - if [[ ! -r ${base} ]] ; then - eerror "Unable to read ${base} -- please check its permissions." - die "Reading config files failed" - fi ewarn "No saved config to restore - please remove USE=savedconfig or" ewarn "provide a configuration file in ${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PN}" - ewarn "Your config file(s) will not be used this time" + ewarn "and ensure the build process has permission to access it." + ewarn "Your config file(s) will not be used this time." fi } -- 2.33.0