• [gentoo-dev] [PATCH 1/4] acct-group.eclass: Fix for when building in a

    From James Le Cuirot@21:1/5 to All on Tue Dec 6 23:30:02 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Le Cuirot@21:1/5 to All on Tue Dec 6 23:30:02 2022
    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} ]
  • From Mike Gilbert@21:1/5 to chewi@gentoo.org on Wed Dec 7 01:00:01 2022
    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. :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Gilbert@21:1/5 to chewi@gentoo.org on Wed Dec 7 01:00:01 2022
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Le Cuirot@21:1/5 to Mike Gilbert on Wed Dec 7 10:30:01 2022
    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.

    -----BEGIN PGP SIGNATURE-----

    iQJFBAABCAAvFiEEPxcZ3tkwcedKm2a8EiZBXQDdMTcFAmOQW8URHGNoZXdpQGdl bnRvby5vcmcACgkQEiZBXQDdMTdNPg//TQes2aodNNmXyHBtmBbK+htwXO0AEsZy 9EY5u1MnXCDW3UzG6pamTf7cM6rdQhxoBexxn0QJXKfiFwg3+MueKJC8hBZ/NAqF 7wuUVxQy7CXISX0ossc9ka5/odiH8Hq/qiK5NyELU0GCIMI61KKH/yPt20qrmDT7 Xvev/V8B7YnjoAafJD4gW/HhjjYy2UJ2q+UaIuIdVyV0ZtXAED/iCxIVfGxPODcY jnwbxJ871ZPXyOc6+Zk/2NCpvh0i7QsAK1+iqT6Rhv9PzwhIi0RuAs3BCIkKO9as YQKGE8RRzNVLqYYuB/NYAmRF18xFPaGyWza4PPiCeDoQhmvOJvg+AzVApkrBeVTe FJblCW1pg2PoigWkMYp/pP8MwMe8rw2OCB6gyF3peluvl+AQN+Xt0o+NYP+KphxI knACPIvG/XvK/MhMXc/HefCmk5W2hALS9/d/8PmCwwjHZ8C6CRhH3zYIIv4lIGcF 1gosuMcDMKfiFSf945CTObRFteIXSz2eRWM4mNBoA+VadyMlPtLlRdaif7XvSoNS 4xGcM3b/nRUv/fadaBz41crB1dVW0udW1VtJrW5nHVzAepEgY256DnTTKUhGPgaU 2txLP/AqwpuY7ffd9utL1oxsvQ2kQaum5ENZTQ0P+oh4OFf4uUrLC6a6XjDCm6Nj
    flkju/Q6a6A=
    =nHB2
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Gilbert@21:1/5 to chewi@gentoo.org on Wed Dec 7 18:00:02 2022
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fabian Groffen@21:1/5 to Mike Gilbert on Wed Dec 7 18:20:02 2022
    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

    -----BEGIN PGP SIGNATURE-----

    iQEzBAABCgAdFiEELUvHd/Gtp7LaU1vuzpXahU5EQpMFAmOQyw8ACgkQzpXahU5E QpORKgf/b9EhOESuPRGDOpVqBwcglhX/4AdTLRS8RnxTx6usfH/w2j28Vq9q35Kc G4Ixgrmu5RXMZpIHVnt7TmhWWjkjfYV6TGGSX0EUjYQRRYkcXKPlhhuitfI8vmuG 197sJ12BLOmXupXql1fNOiGT5cup14kTOMrmHz0Ns2vXna4GKv53B7+bgWtFr7q8 +QUvjdozZCMpMAKIQqyaYVPB8a4pvswccreeShb+tMwZV3DtxQscOaGwyzg5Ttp5 6YgUg3/6g7J351R6R7p8EyJinUicA8kEAxQCVL4i7rxUKFqh7IuGBSd0BmmoFsbe vp4Q05zyO9OUVFNeQiBC9qJRtdE5bQ==
    =wk5Y
    -----END PGP SIGNATURE-----

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