Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 806374

Summary: PMS and Portage disagree about econf --libdir logic
Product: Gentoo Hosted Projects Reporter: Ulrich Müller <ulm>
Component: PMS/EAPIAssignee: PMS/EAPI <pms>
Status: RESOLVED FIXED    
Severity: normal CC: dev-portage, mgorny
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://projects.gentoo.org/pms/8/pms.html#x1-128002r2
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 563798    
Attachments: pkg-mgr-commands.tex: Fix econf --libdir logic

Description Ulrich Müller gentoo-dev 2021-08-04 10:03:42 UTC
PMS says that econf --libdir logic should use --prefix.
https://projects.gentoo.org/pms/8/pms.html#x1-128002r2

Algorithm 12.2: econf --libdir logic
1:  let prefix=${EPREFIX}/usr
2:  if the caller specified --prefix=$p then
3:  let prefix=$p
4:  end if
5:  let libdir=
6:  if the ABI environment variable is set then
7:  let libvar=LIBDIR_$ABI
8:  if the environment variable named by libvar is set then
9:  let libdir=the value of the variable named by libvar
10:  end if
11:  end if
12:  if libdir is non-empty then
13:  pass --libdir=$prefix/$libdir to configure
14:  end if

However, Portage uses --exec-prefix first, then --prefix:

    local CONF_LIBDIR LIBDIR_VAR="LIBDIR_${ABI}"
    if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
        CONF_LIBDIR=${!LIBDIR_VAR}
    fi
    if [[ -n ${CONF_LIBDIR} ]] && ! __hasgq --libdir=\* "$@" ; then
        export CONF_PREFIX=$(__hasg --exec-prefix=\* "$@")
        [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(__hasg --prefix=\* "$@")
        : ${CONF_PREFIX:=${EPREFIX}/usr}
        CONF_PREFIX=${CONF_PREFIX#*=}
        [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
        [[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
        conf_args+=(
            --libdir="$(__strip_duplicate_slashes "${CONF_PREFIX}${CONF_LIBDIR}")"
        )
    fi

This behaviour was introduced in 2005:
https://gitweb.gentoo.org/archive/proj/portage-cvs.git/commit/?h=portage_2_0&id=865508e5cb2fd3e6ef7c312b6a7bb88cf8799f9c

For the record, Pkgcore agrees with Portage (or rather, it will when bug 806362 is fixed).

Paludis uses --prefix first, then --exec-prefix (so it disagrees with both PMS and Portage).
Comment 1 Ulrich Müller gentoo-dev 2021-08-04 10:07:37 UTC
So, given that:
- Portage behaviour predates PMS
- Pkgcore and Paludis look at --exec-prefix too (but they don't agree on order)
- Autoconf default for libdir is relative to exec_prefix

I tend to say that we should update PMS retroactively.

Any other opinions?
Comment 2 Ulrich Müller gentoo-dev 2021-08-04 10:18:23 UTC
Created attachment 730084 [details, diff]
pkg-mgr-commands.tex: Fix econf --libdir logic

If we should decide to update the spec, the fix would look like this.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-08-04 10:40:02 UTC
(In reply to Ulrich Müller from comment #2)
> Created attachment 730084 [details, diff] [details, diff]
> pkg-mgr-commands.tex: Fix econf --libdir logic
> 
> If we should decide to update the spec, the fix would look like this.

WFM.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-08-04 10:45:14 UTC
I'm going to try cutting a new release today.  That is, if I don't forget.
Comment 5 Ulrich Müller gentoo-dev 2021-08-04 17:32:10 UTC
(In reply to Michał Górny from comment #4)
> I'm going to try cutting a new release today.  That is, if I don't forget.

Wrong bug. :)
Comment 6 Larry the Git Cow gentoo-dev 2021-08-09 04:50:31 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/pms.git/commit/?id=140aac7de90b44e7a14b4f5aaf5952911ad074ea

commit 140aac7de90b44e7a14b4f5aaf5952911ad074ea
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-08-04 10:10:59 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2021-08-04 10:10:59 +0000

    pkg-mgr-commands.tex: Fix econf --libdir logic
    
    Portage uses both --exec-prefix and --prefix in its econf logic,
    introduced in 2005:
    https://gitweb.gentoo.org/archive/proj/portage-cvs.git/commit/?h=portage_2_0&id=865508e5cb2fd3e6ef7c312b6a7bb88cf8799f9c
    
    Pkgcore agrees with Portage.
    
    Paludis uses --prefix first, then --exec-prefix.
    
    Closes: https://bugs.gentoo.org/806374
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 pkg-mgr-commands.tex | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)