Mailing List Archive

[PATCH 3/4] user-info.eclass: Fix for when building in a rooted prefix (EROOT)
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
Re: [PATCH 3/4] user-info.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:
>
> 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.