• [gentoo-dev] [PATCH] user-info.eclass: return immediately if db does no

    From Bertrand Jacquin@21:1/5 to All on Sun Feb 19 23:50:01 2023
    Using portage to bootstrap gentoo install can lead to the following
    warning when ROOT is empty:

    >> Running pre-merge checks for acct-group/root-0
    grep: /tmp/0xff.z2MjAjJXuo/root/etc/group: No such file or directory
    grep: /tmp/0xff.z2MjAjJXuo/root/etc/group: No such file or directory

    This change prevent egetent() from attempting to lookup key if database
    does not exit, removing error from output.

    Signed-off-by: Bertrand Jacquin <bertrand@jacquin.bzh>
    ---
    eclass/user-info.eclass | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass
    index b18f280c1022..79d33d6881ae 100644
    --- a/eclass/user-info.eclass
    +++ b/eclass/user-info.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 1999-2022 Gentoo Authors
    +# Copyright 1999-2023 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: user-info.eclass
    @@ -34,6 +34,9 @@ egetent() {
    *) die "sorry, database '${db}' not yet supported; file a bug" ;;
    esac

    + # return immediately if db does not exist
    + [[ ! -e "${EROOT}/etc/${db}" ]] && return 1
    +
    case ${CHOST} in
    *-freebsd*|*-dragonfly*)
    case ${db} in

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Gilbert@21:1/5 to bertrand@jacquin.bzh on Mon Feb 20 20:00:01 2023
    On Sun, Feb 19, 2023 at 5:40 PM Bertrand Jacquin <bertrand@jacquin.bzh> wrote:

    Using portage to bootstrap gentoo install can lead to the following
    warning when ROOT is empty:

    >> Running pre-merge checks for acct-group/root-0
    grep: /tmp/0xff.z2MjAjJXuo/root/etc/group: No such file or directory
    grep: /tmp/0xff.z2MjAjJXuo/root/etc/group: No such file or directory

    This change prevent egetent() from attempting to lookup key if database
    does not exit, removing error from output.

    Signed-off-by: Bertrand Jacquin <bertrand@jacquin.bzh>
    ---
    eclass/user-info.eclass | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass
    index b18f280c1022..79d33d6881ae 100644
    --- a/eclass/user-info.eclass
    +++ b/eclass/user-info.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 1999-2022 Gentoo Authors
    +# Copyright 1999-2023 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: user-info.eclass
    @@ -34,6 +34,9 @@ egetent() {
    *) die "sorry, database '${db}' not yet supported; file a bug" ;;
    esac

    + # return immediately if db does not exist
    + [[ ! -e "${EROOT}/etc/${db}" ]] && return 1
    +
    case ${CHOST} in
    *-freebsd*|*-dragonfly*)
    case ${db} in


    This change makes sense to me.

    The "return 1" made me think about the return value a bit more. If we
    want to replicate the behavior of getent from glibc, we should return
    2 if the user/group does not exist or if the passwd/group files are
    missing. I don't think any ebuild/eclass code really cares about the
    specific status though, so we can leave that alone for now.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)