Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT)
Date: Wed, 07 Dec 2022 09:24:33
Message-Id: e39520806d6d7917ff03c06680117a7c2ddd77bd.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) by Mike Gilbert
1 On Tue, 2022-12-06 at 18:54 -0500, Mike Gilbert wrote:
2 > On Tue, Dec 6, 2022 at 5:24 PM James Le Cuirot <chewi@g.o> wrote:
3 > >
4 > > Groups are largely irrelevant for prefix, but we still don't want the
5 > > build to break.
6 > >
7 > > Signed-off-by: James Le Cuirot <chewi@g.o>
8 > > ---
9 > > eclass/acct-group.eclass | 2 +-
10 > > 1 file changed, 1 insertion(+), 1 deletion(-)
11 > >
12 > > diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
13 > > index 590a2f20ed8e..ada5fe386693 100644
14 > > --- a/eclass/acct-group.eclass
15 > > +++ b/eclass/acct-group.eclass
16 > > @@ -176,7 +176,7 @@ acct-group_pkg_preinst() {
17 > > fi
18 > >
19 > > if [[ -n ${ROOT} ]]; then
20 >
21 > You should probably change this to [[ -n ${EROOT} ]]. Same goes for
22 > acct-user.eclass.
23 >
24 > Also see bug 779181; I'm not sure updating ${EROOT}/etc/group and
25 > ${EROOT}/etc/passwd makes any sense at all.
26
27 Hmm. On closer inspection, and after seeing that bug, I realise I have made
28 some bad assumptions.
29
30 I glanced at my old prefix and saw a bunch of additional users and groups in
31 there, so I figured the tools must have automatically operated on
32 ${EPREFIX}/etc. In fact, user.eclass skipped the operation if you were root,
33 and these files were merely copies from /etc. I tried groupadd from a prefix,
34 and it defaulted to /etc.
35
36 The new eclasses also skip the operation if you are root. As that bug report
37 says, running a prefixed system as root is probably unsupported. I was doing
38 this as root into a ROOTed prefix though, which is slightly different. Should
39 we also skip the operation if EPREFIX non-empty? I'll think about it.
40
41 Thanks for pointing this out.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies