* [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT)
@ 2022-12-06 22:24 James Le Cuirot
2022-12-06 22:24 ` [gentoo-dev] [PATCH 2/4] acct-user.eclass: " James Le Cuirot
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: James Le Cuirot @ 2022-12-06 22:24 UTC (permalink / raw
To: gentoo-dev; +Cc: James Le Cuirot
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 2/4] acct-user.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-06 22:24 [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) James Le Cuirot
@ 2022-12-06 22:24 ` James Le Cuirot
2022-12-06 22:24 ` [gentoo-dev] [PATCH 3/4] user-info.eclass: " James Le Cuirot
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: James Le Cuirot @ 2022-12-06 22:24 UTC (permalink / raw
To: gentoo-dev; +Cc: James Le Cuirot
Users 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-user.eclass | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index b15599c5dd6f..538cc6ae8ec3 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -200,7 +200,7 @@ eislocked() {
# but we also expire the account which is more clear
local shadow
if [[ -n "${ROOT}" ]]; then
- shadow=$(grep "^$1:" "${ROOT}/etc/shadow")
+ shadow=$(grep "^$1:" "${EROOT}/etc/shadow")
else
shadow=$(getent shadow "$1")
fi
@@ -362,7 +362,7 @@ acct-user_pkg_preinst() {
fi
if [[ -n ${ROOT} ]]; then
- opts+=( --prefix "${ROOT}" )
+ opts+=( --prefix "${EROOT}" )
fi
elog "Adding user ${ACCT_USER_NAME}"
@@ -431,7 +431,7 @@ acct-user_pkg_postinst() {
fi
if [[ -n ${ROOT} ]]; then
- opts+=( --prefix "${ROOT}" )
+ opts+=( --prefix "${EROOT}" )
fi
elog "Updating user ${ACCT_USER_NAME}"
@@ -483,7 +483,7 @@ acct-user_pkg_prerm() {
)
if [[ -n ${ROOT} ]]; then
- opts+=( --prefix "${ROOT}" )
+ opts+=( --prefix "${EROOT}" )
fi
elog "Locking user ${ACCT_USER_NAME}"
--
2.38.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 3/4] user-info.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-06 22:24 [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) James Le Cuirot
2022-12-06 22:24 ` [gentoo-dev] [PATCH 2/4] acct-user.eclass: " James Le Cuirot
@ 2022-12-06 22:24 ` James Le Cuirot
2022-12-06 23:57 ` Mike Gilbert
2022-12-06 22:24 ` [gentoo-dev] [PATCH 4/4] user.eclass: " James Le Cuirot
2022-12-06 23:54 ` [gentoo-dev] [PATCH 1/4] acct-group.eclass: " Mike Gilbert
3 siblings, 1 reply; 10+ messages in thread
From: James Le Cuirot @ 2022-12-06 22:24 UTC (permalink / raw
To: gentoo-dev; +Cc: James Le Cuirot
Users 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/user-info.eclass | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass
index 5550e4f08eeb..1339e36634a8 100644
--- a/eclass/user-info.eclass
+++ b/eclass/user-info.eclass
@@ -48,7 +48,7 @@ egetent() {
fi
# Handle different ROOT
- [[ -n ${ROOT} ]] && opts+=( -R "${ROOT}" )
+ [[ -n ${ROOT} ]] && opts+=( -R "${EROOT}" )
pw show ${db} ${opts} "${key}" -q
;;
@@ -64,9 +64,9 @@ egetent() {
getent "${db}" "${key}"
else
if [[ ${key} =~ ^[[:digit:]]+$ ]]; then
- grep -E "^([^:]*:){2}${key}" "${ROOT}/etc/${db}"
+ grep -E "^([^:]*:){2}${key}" "${EROOT}/etc/${db}"
else
- grep "^${key}:" "${ROOT}/etc/${db}"
+ grep "^${key}:" "${EROOT}/etc/${db}"
fi
fi
;;
@@ -167,7 +167,7 @@ egetgroups() {
local egroups_arr
if [[ -n "${ROOT}" ]]; then
local pgroup=$(egetent passwd "$1" | cut -d: -f1)
- local sgroups=( $(grep -E ":([^:]*,)?$1(,[^:]*)?$" "${ROOT}/etc/group" | cut -d: -f1) )
+ local sgroups=( $(grep -E ":([^:]*,)?$1(,[^:]*)?$" "${EROOT}/etc/group" | cut -d: -f1) )
# Remove primary group from list
sgroups=${sgroups#${pgroup}}
--
2.38.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH 4/4] user.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-06 22:24 [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) James Le Cuirot
2022-12-06 22:24 ` [gentoo-dev] [PATCH 2/4] acct-user.eclass: " James Le Cuirot
2022-12-06 22:24 ` [gentoo-dev] [PATCH 3/4] user-info.eclass: " James Le Cuirot
@ 2022-12-06 22:24 ` James Le Cuirot
2022-12-06 23:55 ` Mike Gilbert
2022-12-06 23:54 ` [gentoo-dev] [PATCH 1/4] acct-group.eclass: " Mike Gilbert
3 siblings, 1 reply; 10+ messages in thread
From: James Le Cuirot @ 2022-12-06 22:24 UTC (permalink / raw
To: gentoo-dev; +Cc: James Le Cuirot
Users are largely irrelevant for prefix, but we still don't want the
build to break.
I left the home and shell related bits alone, as it's less clear whether
these should be prefixed or not. Obviously /dev/null should not be. It's
slightly academic anyway, as nothing in the main repo uses this eclass
any more.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
eclass/user.eclass | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/eclass/user.eclass b/eclass/user.eclass
index 02e1074fe4d6..9daa1f807e07 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -119,7 +119,7 @@ enewuser() {
local opts=()
# handle for ROOT != /
- [[ -n ${ROOT} ]] && opts+=( --prefix "${ROOT}" )
+ [[ -n ${ROOT} ]] && opts+=( --prefix "${EROOT}" )
# handle uid
local euid=${1}; shift
@@ -307,7 +307,7 @@ enewgroup() {
# handle different ROOT
local opts
- [[ -n ${ROOT} ]] && opts=( --prefix "${ROOT}" )
+ [[ -n ${ROOT} ]] && opts=( --prefix "${EROOT}" )
# handle extra
if [[ $# -gt 0 ]] ; then
@@ -383,7 +383,7 @@ esethome() {
# Handle different ROOT
local opts
- [[ -n ${ROOT} ]] && opts=( --prefix "${ROOT}" )
+ [[ -n ${ROOT} ]] && opts=( --prefix "${EROOT}" )
# handle homedir
local ehome=${1}; shift
@@ -469,7 +469,7 @@ esetshell() {
# Handle different ROOT
local opts
- [[ -n ${ROOT} ]] && opts=( --prefix "${ROOT}" )
+ [[ -n ${ROOT} ]] && opts=( --prefix "${EROOT}" )
# handle shell
local eshell=${1}; shift
@@ -546,7 +546,7 @@ esetcomment() {
# Handle different ROOT
local opts
- [[ -n ${ROOT} ]] && opts=( --prefix "${ROOT}" )
+ [[ -n ${ROOT} ]] && opts=( --prefix "${EROOT}" )
# handle comment
local ecomment=${1}; shift
@@ -647,7 +647,7 @@ esetgroups() {
elog " - Groups: ${egroups}"
# Handle different ROOT
- [[ -n ${ROOT} ]] && opts+=( --prefix "${ROOT}" )
+ [[ -n ${ROOT} ]] && opts+=( --prefix "${EROOT}" )
# update the group
case ${CHOST} in
--
2.38.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-06 22:24 [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) James Le Cuirot
` (2 preceding siblings ...)
2022-12-06 22:24 ` [gentoo-dev] [PATCH 4/4] user.eclass: " James Le Cuirot
@ 2022-12-06 23:54 ` Mike Gilbert
2022-12-07 9:24 ` James Le Cuirot
3 siblings, 1 reply; 10+ messages in thread
From: Mike Gilbert @ 2022-12-06 23:54 UTC (permalink / raw
To: gentoo-dev; +Cc: James Le Cuirot
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH 4/4] user.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-06 22:24 ` [gentoo-dev] [PATCH 4/4] user.eclass: " James Le Cuirot
@ 2022-12-06 23:55 ` Mike Gilbert
0 siblings, 0 replies; 10+ messages in thread
From: Mike Gilbert @ 2022-12-06 23:55 UTC (permalink / raw
To: gentoo-dev; +Cc: James Le Cuirot
On Tue, Dec 6, 2022 at 5:24 PM James Le Cuirot <chewi@gentoo.org> wrote:
>
> Users are largely irrelevant for prefix, but we still don't want the
> build to break.
>
> I left the home and shell related bits alone, as it's less clear whether
> these should be prefixed or not. Obviously /dev/null should not be. It's
> slightly academic anyway, as nothing in the main repo uses this eclass
> any more.
I just deleted user.eclass, so you can probably drop this patch. :-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH 3/4] user-info.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-06 22:24 ` [gentoo-dev] [PATCH 3/4] user-info.eclass: " James Le Cuirot
@ 2022-12-06 23:57 ` Mike Gilbert
0 siblings, 0 replies; 10+ messages in thread
From: Mike Gilbert @ 2022-12-06 23:57 UTC (permalink / raw
To: gentoo-dev; +Cc: James Le Cuirot
On Tue, Dec 6, 2022 at 5:24 PM James Le Cuirot <chewi@gentoo.org> wrote:
>
> Users 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/user-info.eclass | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass
> index 5550e4f08eeb..1339e36634a8 100644
> --- a/eclass/user-info.eclass
> +++ b/eclass/user-info.eclass
> @@ -48,7 +48,7 @@ egetent() {
> fi
>
> # Handle different ROOT
> - [[ -n ${ROOT} ]] && opts+=( -R "${ROOT}" )
> + [[ -n ${ROOT} ]] && opts+=( -R "${EROOT}" )
Another case where the [[ -n ${ROOT} ]] should probably be changed to
[[ -n ${EROOT} ]] if you actually want this to be prefix-aware.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-06 23:54 ` [gentoo-dev] [PATCH 1/4] acct-group.eclass: " Mike Gilbert
@ 2022-12-07 9:24 ` James Le Cuirot
2022-12-07 16:52 ` Mike Gilbert
0 siblings, 1 reply; 10+ messages in thread
From: James Le Cuirot @ 2022-12-07 9:24 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]
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.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 858 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-07 9:24 ` James Le Cuirot
@ 2022-12-07 16:52 ` Mike Gilbert
2022-12-07 17:19 ` Fabian Groffen
0 siblings, 1 reply; 10+ messages in thread
From: Mike Gilbert @ 2022-12-07 16:52 UTC (permalink / raw
To: gentoo-dev
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT)
2022-12-07 16:52 ` Mike Gilbert
@ 2022-12-07 17:19 ` Fabian Groffen
0 siblings, 0 replies; 10+ messages in thread
From: Fabian Groffen @ 2022-12-07 17:19 UTC (permalink / raw
To: gentoo-dev; +Cc: Benda Xu
[-- Attachment #1: Type: text/plain, Size: 840 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-12-07 17:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-06 22:24 [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a rooted prefix (EROOT) James Le Cuirot
2022-12-06 22:24 ` [gentoo-dev] [PATCH 2/4] acct-user.eclass: " James Le Cuirot
2022-12-06 22:24 ` [gentoo-dev] [PATCH 3/4] user-info.eclass: " James Le Cuirot
2022-12-06 23:57 ` Mike Gilbert
2022-12-06 22:24 ` [gentoo-dev] [PATCH 4/4] user.eclass: " James Le Cuirot
2022-12-06 23:55 ` Mike Gilbert
2022-12-06 23:54 ` [gentoo-dev] [PATCH 1/4] acct-group.eclass: " Mike Gilbert
2022-12-07 9:24 ` James Le Cuirot
2022-12-07 16:52 ` Mike Gilbert
2022-12-07 17:19 ` Fabian Groffen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox