Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 29 Sep 2021 19:33:34
Message-Id: 1632943964.c3c88c805320021786d2bb925918e9ba2d15c79d.floppym@gentoo
1 commit: c3c88c805320021786d2bb925918e9ba2d15c79d
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 26 23:47:13 2021 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 29 19:32:44 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3c88c80
7
8 savedconfig.eclass: drop faulty permissions check
9
10 This check was meant to test if the user has accidentally restricted
11 access to the /etc/portage/savedconfig directory. There are a few
12 problems:
13
14 1. We don't actually need read access on the directory. We really need
15 the execute bit set so that we can access files within the directory.
16
17 2. There may be permissions issues on subdirectories, and we would fail
18 to detect them.
19
20 3. There is no easy way to distingish between EACCES and ENOENT using
21 shell commands. We get an exit status of 1 from [[ -r ${path} ]] if
22 there is a permissions problem or if some component of the path does
23 not exist. This makes resolving problem 2 difficult without using a
24 more robust language with direct access to errno.
25
26 Instead of trying to detect a permissions problem, just output a warning
27 telling the user to check permissions if we cannot find a config file.
28
29 Bug: https://bugs.gentoo.org/289168
30 Bug: https://bugs.gentoo.org/814995
31 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
32
33 eclass/savedconfig.eclass | 10 +++-------
34 1 file changed, 3 insertions(+), 7 deletions(-)
35
36 diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass
37 index e90a9b618d6..c4fd0c492f4 100644
38 --- a/eclass/savedconfig.eclass
39 +++ b/eclass/savedconfig.eclass
40 @@ -1,4 +1,4 @@
41 -# Copyright 1999-2020 Gentoo Authors
42 +# Copyright 1999-2021 Gentoo Authors
43 # Distributed under the terms of the GNU General Public License v2
44
45 # @ECLASS: savedconfig.eclass
46 @@ -146,14 +146,10 @@ restore_config() {
47 treecopy . "${dest}" || die "Failed to restore ${found} to $1"
48 popd > /dev/null
49 else
50 - # maybe the user is screwing around with perms they shouldnt #289168
51 - if [[ ! -r ${base} ]] ; then
52 - eerror "Unable to read ${base} -- please check its permissions."
53 - die "Reading config files failed"
54 - fi
55 ewarn "No saved config to restore - please remove USE=savedconfig or"
56 ewarn "provide a configuration file in ${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PN}"
57 - ewarn "Your config file(s) will not be used this time"
58 + ewarn "and ensure the build process has permission to access it."
59 + ewarn "Your config file(s) will not be used this time."
60 fi
61 }