Gentoo Archives: gentoo-dev

From: Bertrand Jacquin <bertrand@×××××××.bzh>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] user-info.eclass: return immediately if db does not exist
Date: Sun, 19 Feb 2023 22:41:05
Message-Id: 20230219224051.3082346-1-bertrand@jacquin.bzh
1 Using portage to bootstrap gentoo install can lead to the following
2 warning when ROOT is empty:
3
4 >> Running pre-merge checks for acct-group/root-0
5 grep: /tmp/0xff.z2MjAjJXuo/root/etc/group: No such file or directory
6 grep: /tmp/0xff.z2MjAjJXuo/root/etc/group: No such file or directory
7
8 This change prevent egetent() from attempting to lookup key if database
9 does not exit, removing error from output.
10
11 Signed-off-by: Bertrand Jacquin <bertrand@×××××××.bzh>
12 ---
13 eclass/user-info.eclass | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
15
16 diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass
17 index b18f280c1022..79d33d6881ae 100644
18 --- a/eclass/user-info.eclass
19 +++ b/eclass/user-info.eclass
20 @@ -1,4 +1,4 @@
21 -# Copyright 1999-2022 Gentoo Authors
22 +# Copyright 1999-2023 Gentoo Authors
23 # Distributed under the terms of the GNU General Public License v2
24
25 # @ECLASS: user-info.eclass
26 @@ -34,6 +34,9 @@ egetent() {
27 *) die "sorry, database '${db}' not yet supported; file a bug" ;;
28 esac
29
30 + # return immediately if db does not exist
31 + [[ ! -e "${EROOT}/etc/${db}" ]] && return 1
32 +
33 case ${CHOST} in
34 *-freebsd*|*-dragonfly*)
35 case ${db} in

Replies