• [gentoo-dev] [PATCH] Support Makefiles that set variables to a non-stat

    From Mike Pagano@21:1/5 to All on Wed Sep 1 20:50:01 2021
    Previously, the kernel Makefile had to define version variables
    as static string literals to be read.
    This change will allow varibles defined as non-static values
    to be read.

    Bug: https://bugs.gentoo.org/490328

    Signed-off-by: Mike Pagano <mpagano@gentoo.org>
    ---
    eclass/linux-info.eclass | 13 +++++--------
    1 file changed, 5 insertions(+), 8 deletions(-)

    diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
    index 8edd17c31..0b6df1bf5 100644
    --- a/eclass/linux-info.eclass
    +++ b/eclass/linux-info.eclass
    @@ -539,14 +539,11 @@ get_version() {

    # And contrary to existing functions I feel we shouldn't trust the
    # directory name to find version information as this seems insane.
    - # So we parse ${KERNEL_MAKEFILE}. We should be able to trust that
    - # the Makefile is simple enough to use the noexec extract function.
    - # This has been true for every release thus far, and it's faster
    - # than using make to evaluate the Makefile every time.
    - KV_MAJOR=$(getfilevar_noexec VERSION "${KERNEL_MAKEFILE}")
    - KV_MINOR=$(getfilevar_noexec PATCHLEVEL "${KERNEL_MAKEFILE}")
    - KV_PATCH=$(getfilevar_noexec SUBLEVEL "${KERNEL_MAKEFILE}")
    - KV_EXTRA=$(getfilevar_noexec EXTRAVERSION "${KERNEL_MAKEFILE}")
    + # So we parse ${KERNEL_MAKEFILE}.
    + KV_MAJOR
  • From Robin H. Johnson@21:1/5 to Mike Pagano on Thu Sep 9 19:30:02 2021
    On Wed, Sep 01, 2021 at 02:44:11PM -0400, Mike Pagano wrote:
    Previously, the kernel Makefile had to define version variables
    as static string literals to be read.
    This change will allow varibles defined as non-static values
    to be read.
    Hi,

    This change has broken infra systems where /usr/src/ is empty because
    they use a binary kernel. /proc/config.gz does exist on those systems for this use case.

    Specifically, any package that uses linux-info to issues warnings via the '~' syntax now fails because "getfilevar_noexec VERSION ..." returns empty string.

    * Determining the location of the kernel source code
    * Unable to find kernel sources at /usr/src/linux
    * Please make sure that /usr/src/linux points at your running kernel,
    * (or the kernel you wish to build against).
    * Alternatively, set the KERNEL_DIR environment variable to the kernel sources location
    * Unable to calculate Linux Kernel version for build, attempting to use running version
    * ERROR: app-emulation/docker-20.10.7::gentoo failed (setup phase):
    * Unable to determine any Linux Kernel version, please report a bug
    *
    * Call stack:
    * ebuild.sh, line 127: Called pkg_setup
    * docker-20.10.7.ebuild, line 110: Called kernel_is 'lt' '4' '5'
    * linux-info.eclass, line 405: Called linux-info_get_any_version
    * linux-info.eclass, line 678: Called die
    * The specific snippet of code:
    * die "Unable to determine any Linux Kernel version, please report a bug"

    I'd like to propose that we revert the original CVS change that supported the fallback to getfilevar_noexec:
    https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/eclass/linux-info.eclass?id=ab160a941f5f52c95b47129d3243c693b05401e5

    --
    Robin Hugh Johnson
    Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
    E-Mail : robbat2@gentoo.org
    GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
    GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2
    Comment: Robbat2 @ Orbis-Terrarum Networks - The text below is a digital signature. If it doesn't make any sense to you, ignore it.

    iQKTBAABCgB9FiEEveu2pS8Vb98xaNkRGTlfI8WIJsQFAmE6QpxfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJE RUJCNkE1MkYxNTZGREYzMTY4RDkxMTE5Mzk1RjIzQzU4ODI2QzQACgkQGTlfI8WI JsRPgQ//XRPipZF+IaD45Pp1JyKr/WvC1xyZkplLREY5dyf5QdJ2yhte5gBBC6n4 WYDLH0PqiEisNHxntKh1wAJN4BO+7ELk+kDr9SU4l0Yh5A/Xi7S68VqFa0ByTpni aoaGBjcT08UvnQP3T2aJU1wRajl2lLrYeSZ3dqQsg1ijfByFmpqF0hHxbagvoCf0 TZrDBunyLv7Z1s0Ige6/ucw0ZGVnTQjcwXjAGQz4LYOtmQxS7dsJzhWWzm4uRfmh VklhAdhLbfYvqkL6EG9adOAZlrXWwJ6lkT/Zq/ivgbTz8U3xvdPZLzHSG322l/BO KenUBN2seRZSLCrbjFoWoyhrZfoW9dXPaJq56kBfMEmYDWCk7DpMtHh2kaDJ00a8 AkBjJ2pF7iQPNzEJFZhm
  • From Mike Gilbert@21:1/5 to robbat2@gentoo.org on Thu Sep 9 20:00:05 2021
    On Thu, Sep 9, 2021 at 1:21 PM Robin H. Johnson <robbat2@gentoo.org> wrote:

    On Wed, Sep 01, 2021 at 02:44:11PM -0400, Mike Pagano wrote:
    Previously, the kernel Makefile had to define version variables
    as static string literals to be read.
    This change will allow varibles defined as non-static values
    to be read.
    Hi,

    This change has broken infra systems where /usr/src/ is empty because
    they use a binary kernel. /proc/config.gz does exist on those systems for this
    use case.

    Specifically, any package that uses linux-info to issues warnings via the '~' syntax now fails because "getfilevar_noexec VERSION ..." returns empty string.

    * Determining the location of the kernel source code
    * Unable to find kernel sources at /usr/src/linux
    * Please make sure that /usr/src/linux points at your running kernel,
    * (or the kernel you wish to build against).
    * Alternatively, set the KERNEL_DIR environment variable to the kernel sources location
    * Unable to calculate Linux Kernel version for build, attempting to use running version
    * ERROR: app-emulation/docker-20.10.7::gentoo failed (setup phase):
    * Unable to determine any Linux Kernel version, please report a bug
    *
    * Call stack:
    * ebuild.sh, line 127: Called pkg_setup
    * docker-20.10.7.ebuild, line 110: Called kernel_is 'lt' '4' '5'
    * linux-info.eclass, line 405: Called linux-info_get_any_version
    * linux-info.eclass, line 678: Called die
    * The specific snippet of code:
    * die "Unable to determine any Linux Kernel version, please report a bug"

    I'd like to propose that we revert the original CVS change that supported the fallback to getfilevar_noexec:
    https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/eclass/linux-info.eclass?id=ab160a941f5f52c95b47129d3243c693b05401e5

    I cannot reproduce this with /proc/config.gz present.

    % sudo ebuild docker-20.10.8.ebuild clean setup
    * docker-20.10.8.tar.gz BLAKE2B SHA512 size ;-) ...
    [ ok ]
    * Determining the location of the kernel source code
    * Unable to find kernel sources at /usr/src/linux
    * Please make sure that /usr/src/linux points at your running kernel,
    * (or the kernel you wish to build against).
    * Alternatively, set the KERNEL_DIR environment variable to the
    kernel sources location
    * Unable to calculate Linux Kernel version for build, attempting to
    use running version
    * Checking for suitable kernel configuration options...
    * CONFIG_BRIDGE_NETFILTER: is not set when it should be.
    * CONFIG_IP_NF_TARGET_MASQUERADE: is not set when it should be.
    * CONFIG_NETFILTER_XT_MATCH_IPVS: is not set when it should be.
    * CONFIG_IP_VS: is not set when it should be.
    * CONFIG_IP_VS_PROTO_TCP: is not set when it should be.
    * CONFIG_IP_VS_PROTO_UDP: is not set when it should be.
    * CONFIG_IP_VS_NFCT: is not set when it should be.
    * CONFIG_IP_VS_RR: is not set when it should be.
    * CONFIG_OVERLAY_FS: is not set when it should be.
    * Please check to make sure these options are set correctly.
    * Failure to do so may cause unexpected problems.

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