Mailing List Archive

[PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT)
Groups are largely irrelevant for prefix, but we still don't want the
build to break.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
eclass/acct-group.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index 590a2f20ed8e..ada5fe386693 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -176,7 +176,7 @@ acct-group_pkg_preinst() {
fi

if [[ -n ${ROOT} ]]; then
- opts+=( --prefix "${ROOT}" )
+ opts+=( --prefix "${EROOT}" )
fi

elog "Adding group ${ACCT_GROUP_NAME}"
--
2.38.1
Re: [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) [ In reply to ]
On Tue, Dec 6, 2022 at 5:24 PM James Le Cuirot <chewi@gentoo.org> wrote:
>
> Groups are largely irrelevant for prefix, but we still don't want the
> build to break.
>
> Signed-off-by: James Le Cuirot <chewi@gentoo.org>
> ---
> eclass/acct-group.eclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> index 590a2f20ed8e..ada5fe386693 100644
> --- a/eclass/acct-group.eclass
> +++ b/eclass/acct-group.eclass
> @@ -176,7 +176,7 @@ acct-group_pkg_preinst() {
> fi
>
> if [[ -n ${ROOT} ]]; then

You should probably change this to [[ -n ${EROOT} ]]. Same goes for
acct-user.eclass.

Also see bug 779181; I'm not sure updating ${EROOT}/etc/group and
${EROOT}/etc/passwd makes any sense at all.
Re: [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) [ In reply to ]
On Tue, 2022-12-06 at 18:54 -0500, Mike Gilbert wrote:
> On Tue, Dec 6, 2022 at 5:24 PM James Le Cuirot <chewi@gentoo.org> wrote:
> >
> > Groups are largely irrelevant for prefix, but we still don't want the
> > build to break.
> >
> > Signed-off-by: James Le Cuirot <chewi@gentoo.org>
> > ---
> > eclass/acct-group.eclass | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> > index 590a2f20ed8e..ada5fe386693 100644
> > --- a/eclass/acct-group.eclass
> > +++ b/eclass/acct-group.eclass
> > @@ -176,7 +176,7 @@ acct-group_pkg_preinst() {
> > fi
> >
> > if [[ -n ${ROOT} ]]; then
>
> You should probably change this to [[ -n ${EROOT} ]]. Same goes for
> acct-user.eclass.
>
> Also see bug 779181; I'm not sure updating ${EROOT}/etc/group and
> ${EROOT}/etc/passwd makes any sense at all.

Hmm. On closer inspection, and after seeing that bug, I realise I have made
some bad assumptions.

I glanced at my old prefix and saw a bunch of additional users and groups in
there, so I figured the tools must have automatically operated on
${EPREFIX}/etc. In fact, user.eclass skipped the operation if you were root,
and these files were merely copies from /etc. I tried groupadd from a prefix,
and it defaulted to /etc.

The new eclasses also skip the operation if you are root. As that bug report
says, running a prefixed system as root is probably unsupported. I was doing
this as root into a ROOTed prefix though, which is slightly different. Should
we also skip the operation if EPREFIX non-empty? I'll think about it.

Thanks for pointing this out.
Re: [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) [ In reply to ]
On Wed, Dec 7, 2022 at 4:24 AM James Le Cuirot <chewi@gentoo.org> wrote:
> The new eclasses also skip the operation if you are root. As that bug report
> says, running a prefixed system as root is probably unsupported. I was doing
> this as root into a ROOTed prefix though, which is slightly different. Should
> we also skip the operation if EPREFIX non-empty? I'll think about it.

I would be in favor of skipping adding users/groups if EPREFIX is
non-empty, at least as a temporary solution.

If someone presents a use case where adding users to
${EROOT}/etc/passwd makes sense, we can revisit it then.
Re: [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) [ In reply to ]
On 07-12-2022 11:52:58 -0500, Mike Gilbert wrote:
> On Wed, Dec 7, 2022 at 4:24 AM James Le Cuirot <chewi@gentoo.org> wrote:
> > The new eclasses also skip the operation if you are root. As that bug report
> > says, running a prefixed system as root is probably unsupported. I was doing
> > this as root into a ROOTed prefix though, which is slightly different. Should
> > we also skip the operation if EPREFIX non-empty? I'll think about it.
>
> I would be in favor of skipping adding users/groups if EPREFIX is
> non-empty, at least as a temporary solution.
>
> If someone presents a use case where adding users to
> ${EROOT}/etc/passwd makes sense, we can revisit it then.

Would have to look if RAP uses this.
@heroxbd do you know if that is used?

Thanks,
Fabian

--
Fabian Groffen
Gentoo on a different level