Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 814368 - EAPI 8 --disable-static problems
Summary: EAPI 8 --disable-static problems
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PMS/EAPI
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 829106
  Show dependency tree
 
Reported: 2021-09-22 15:26 UTC by Mike Gilbert
Modified: 2022-11-25 17:59 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
pkg-mgr-commands.tex: Update condition for econf --disable-static (0001-pkg-mgr-commands.tex-Update-condition-for-econf-disa.patch,1.95 KB, patch)
2021-09-24 12:22 UTC, Ulrich Müller
Details | Diff
pkg-mgr-commands.tex: Update condition for econf --disable-static (0001-pkg-mgr-commands.tex-Update-condition-for-econf-disa.patch,1.83 KB, patch)
2021-09-24 13:14 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gilbert gentoo-dev 2021-09-22 15:26:16 UTC
PMS states that in EAPI 8, "--disable-static" must be passed to econf if it appears in the output of configure --help.

This is problematic in a couple of ways:

1. For packages using libtool, configure --help outputs a string like this:

>   --enable-static[=PKGS]  build static libraries [default=yes]

The string "--disable-static" does not appear.


2. Some packages have configure options like "--enable-static-foo", but not "--enable-static" or "--disable-static".

For example, net-vpn/tor has the following configure options:

>   --enable-static-openssl link against a static openssl library. Requires
>   --enable-static-libevent
>                           link against a static libevent library. Requires
>   --enable-static-zlib    link against a static zlib library. Requires
>   --enable-static-tor     create an entirely static Tor binary. Requires
>                           Build without support for zstd's "static-only" APIs.
                        Build without support for zstd's "static-only" APIs.


The current Portage implementation checks for either *--enable-static* or *--disable-static*. This addresses the first problem, but fails to address the second problem.
Comment 1 Mike Gilbert gentoo-dev 2021-09-22 15:29:21 UTC
> (In reply to Mike Gilbert from comment #0)
> PMS states that in EAPI 8, "--disable-static" must be passed to econf if it
> appears in the output of configure --help.

I meant to write:

PMS states that in EAPI 8, econf must pass "--disable-static" to configure if it appears in the output of configure --help.
Comment 2 Ulrich Müller gentoo-dev 2021-09-22 15:57:39 UTC
(In reply to Mike Gilbert from comment #0)
> The current Portage implementation checks for either *--enable-static* or
> *--disable-static*.

That doesn't follow the spec, which explicitly says that --disable-static must occur in the output of configure --help.
Comment 3 Ulrich Müller gentoo-dev 2021-09-23 08:24:07 UTC
The help message produced by LT_INIT in libtool-2.4.6 always says "--enable-static" regardless of the default value, see m4/ltoptions.m4:

AC_ARG_ENABLE([static],
    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
    ...)

This means that the behaviour specified by PMS is non-functional.

Since the damage is already done by Portage not following the spec, how about retroactively changing PMS to the following wording:

"--disable-static, if the EAPI is listed in table 12.8 as using it. This option will only be passed if the string --disable-static or --enable-static occurs in the output of configure --help; the string must not be immediately followed by any of the characters [A-Za-z0-9+_.-].

https://projects.gentoo.org/pms/8/pms.html#x1-12800012.3.8
Comment 4 Ulrich Müller gentoo-dev 2021-09-24 12:22:33 UTC
Created attachment 740970 [details, diff]
pkg-mgr-commands.tex: Update condition for econf --disable-static

This would be the corresponding patch for the spec.

Slightly simplified regexp but shouldn't make any difference in practice.
Comment 5 Ulrich Müller gentoo-dev 2021-09-24 13:14:43 UTC
Created attachment 740982 [details, diff]
pkg-mgr-commands.tex: Update condition for econf --disable-static

As discussed in #gentoo-pms, let's fix only item 1 for now (i.e. update PMS to follow Portage).

Item 2 from comment #0 (fix --enable-static-openssl etc.) can be fixed in the next EAPI. IIUC it is a minor problem and should only cause configure to output a warning that option --disable-static is not available. Fixing it in the next EAPI has the advantage that we can check for a proper end of the option name for all options where we test --help output.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-09-24 13:15:35 UTC
I've tried digging a bit to figure out how we ended up with this... and I'm afraid I haven't been able to find anything specific.  I suspect a major cause of all this was the huge delay between my first efforts at implementing preliminary EAPI 8 features back in 2020, and the fast-effort in 2021.

FWICS the Portage behavior of matching disable and enable was part of the original patch that predates the PMS.  I suspect that I've noticed the first problem during initial testing and updated the patch to account for it.  However, that information doesn't seem to have made back into the bug, and it seems that we failed to notice while working on the PMS.


For EAPI 8, I think we should update PMS to match Portage behavior.  After all, that was the intended and tested behavior from day one.  The PMS/PkgCore implementation is not really meaningful given that it simply doesn't work on the majority of packages.  This has the obvious advantage that packages behave consistently independently of Portage version.

On the other hand, I wouldn't change it to account for possible other option names today.  This really sounds like a corner case of a corner case, and I think the gain here doesn't justify making things more inconsistent here.


For EAPI 9, I think we should go for consistency all the way.  That is:

a. make all --enable options match either --enable or --disable (should we do that for --with and --without too?)

b. state that when matching option names in --help output, they 'must [not] be followed by ...'
Comment 7 Ulrich Müller gentoo-dev 2021-09-24 14:22:01 UTC
(In reply to Michał Górny from comment #6)
> For EAPI 9, I think we should go for consistency all the way.  That is:
> 
> a. make all --enable options match either --enable or --disable (should we
> do that for --with and --without too?)
> 
> b. state that when matching option names in --help output, they 'must [not]
> be followed by ...'

While I agree to item b, I'd rather not open the can of worms that comes with item a (which would affect --with-sysroot, --disable-dependency-tracking and --disable-silent-rules AFAICS). Is there a single case known where configure --help outputs the "enable" variant for these (with enable being the default)?
Comment 8 Ulrich Müller gentoo-dev 2021-09-24 14:30:51 UTC
(In reply to Ulrich Müller from comment #7)
> Is there a single case known where configure --help outputs the "enable"
> variant for these (with enable being the default)?

This should read "outputs _only_ the 'enable' variant".
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-09-27 09:43:54 UTC
PkgCore update ready.
Comment 10 Larry the Git Cow gentoo-dev 2021-09-27 17:00:08 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/pms.git/commit/?id=8ce3a9c94407c8bfcf27c8455fac32d3a38fc981

commit 8ce3a9c94407c8bfcf27c8455fac32d3a38fc981
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-09-24 12:12:38 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2021-09-24 13:06:45 +0000

    pkg-mgr-commands.tex: Update condition for econf --disable-static
    
    The help message produced by LT_INIT in libtool-2.4.6 always says
    --enable-static regardless of the default value, see m4/ltoptions.m4:
    
    AC_ARG_ENABLE([static],
        [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
            [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
        ...)
    
    This means that looking only for --disable-static in output of
    configure --help results in non-functional behaviour.
    
    Implementation in Portage (which predates the PMS wording) looks for
    --enable-static in addition.
    
    Bug: https://bugs.gentoo.org/814368
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 pkg-mgr-commands.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 11 Ulrich Müller gentoo-dev 2021-09-27 17:41:13 UTC
Closing. I have filed bug 815169 for the followup change in EAPI 9.
Comment 12 Larry the Git Cow gentoo-dev 2022-11-25 17:59:49 UTC
The bug has been referenced in the following commit(s):

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

commit e0aa80cc0d28a25bfc68b4671771083e282f6ba2
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-11-19 20:22:34 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-11-19 20:22:34 +0000

    pkg-mgr-commands.tex: Update condition for econf --disable-static (again)
    
    The intention is to pass --disable-static, in order to (only) disable
    static libtool archive building. The current condition asks for either
    of --{disable,enable}-static in configure --help output, which causes
    false positives:
    https://archives.gentoo.org/gentoo-portage-dev/message/efc3f424d1dffd3415da538ec25532a9
    
    Therefore, narrow the condition to require both --enable-static and
    --enable-shared. In addition, backport the check for proper end of
    string from the EAPI 9 feature list, but restrict it to this option
    for now.
    
    Bug: https://bugs.gentoo.org/814368
    Bug: https://bugs.gentoo.org/815169
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 pkg-mgr-commands.tex | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)