1 |
On Sun, Feb 19, 2023 at 5:40 PM Bertrand Jacquin <bertrand@×××××××.bzh> wrote: |
2 |
> |
3 |
> Using portage to bootstrap gentoo install can lead to the following |
4 |
> warning when ROOT is empty: |
5 |
> |
6 |
> >> Running pre-merge checks for acct-group/root-0 |
7 |
> grep: /tmp/0xff.z2MjAjJXuo/root/etc/group: No such file or directory |
8 |
> grep: /tmp/0xff.z2MjAjJXuo/root/etc/group: No such file or directory |
9 |
> |
10 |
> This change prevent egetent() from attempting to lookup key if database |
11 |
> does not exit, removing error from output. |
12 |
> |
13 |
> Signed-off-by: Bertrand Jacquin <bertrand@×××××××.bzh> |
14 |
> --- |
15 |
> eclass/user-info.eclass | 5 ++++- |
16 |
> 1 file changed, 4 insertions(+), 1 deletion(-) |
17 |
> |
18 |
> diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass |
19 |
> index b18f280c1022..79d33d6881ae 100644 |
20 |
> --- a/eclass/user-info.eclass |
21 |
> +++ b/eclass/user-info.eclass |
22 |
> @@ -1,4 +1,4 @@ |
23 |
> -# Copyright 1999-2022 Gentoo Authors |
24 |
> +# Copyright 1999-2023 Gentoo Authors |
25 |
> # Distributed under the terms of the GNU General Public License v2 |
26 |
> |
27 |
> # @ECLASS: user-info.eclass |
28 |
> @@ -34,6 +34,9 @@ egetent() { |
29 |
> *) die "sorry, database '${db}' not yet supported; file a bug" ;; |
30 |
> esac |
31 |
> |
32 |
> + # return immediately if db does not exist |
33 |
> + [[ ! -e "${EROOT}/etc/${db}" ]] && return 1 |
34 |
> + |
35 |
> case ${CHOST} in |
36 |
> *-freebsd*|*-dragonfly*) |
37 |
> case ${db} in |
38 |
> |
39 |
|
40 |
This change makes sense to me. |
41 |
|
42 |
The "return 1" made me think about the return value a bit more. If we |
43 |
want to replicate the behavior of getent from glibc, we should return |
44 |
2 if the user/group does not exist or if the passwd/group files are |
45 |
missing. I don't think any ebuild/eclass code really cares about the |
46 |
specific status though, so we can leave that alone for now. |