Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 921197 - dev-util/perf: fails to install from binary packages
Summary: dev-util/perf: fails to install from binary packages
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Guilherme Amadio
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-02 14:08 UTC by pva
Modified: 2024-01-30 15:25 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,1.93 KB, text/x-log)
2024-01-02 14:10 UTC, pva
Details
environment.xz (environment.xz,31.29 KB, application/x-xz)
2024-01-02 14:11 UTC, pva
Details
emerge--info.txt (emerge--info.txt,9.13 KB, text/plain)
2024-01-02 14:11 UTC, pva
Details
perf-6.6.ebuild.patch (perf-6.6.ebuild.patch,454 bytes, patch)
2024-01-02 14:27 UTC, pva
Details | Diff
perf-6.6.ebuild.patch (perf-6.6.ebuild.patch,996 bytes, patch)
2024-01-03 09:14 UTC, pva
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pva 2024-01-02 14:08:50 UTC
Every time I try to install dev-util/perf-6.6 from binary packages it fails with the following error:

============================================================================
 * Checking for suitable kernel configuration options ...
 *   CONFIG_DEBUG_INFO:	 is not set when it should be.
 *   CONFIG_DEBUG_INFO_BTF:	 is not set when it should be.
/var/tmp/portage/dev-util/perf-6.6/temp/environment: line 1479: ERROR_HAVE_EBPF_JIT~BPF: invalid variable name
 * The ebuild phase 'setup' has exited unexpectedly. This type of behavior
 * is known to be triggered by things such as failed variable assignments
 * (bug #190128) or bad substitution errors (bug #200313). Normally, before
 * exiting, bash should have displayed an error message above. If bash did
 * not produce an error message above, it's possible that the ebuild has
 * called `exit` when it should have called `die` instead. This behavior
 * may also be triggered by a corrupt bash binary or a hardware problem
 * such as memory or cpu malfunction. If the problem is not reproducible or
 * it appears to occur randomly, then it is likely to be triggered by a
 * hardware problem. If you suspect a hardware problem then you should try
 * some basic hardware diagnostics such as memtest. Please do not report
 * this as a bug unless it is consistently reproducible and you are sure
 * that your bash binary and hardware are functioning properly.

============================================================================

The problem here is that pkg_setup() is run twice: once during building binary package and another time during installation. And this means the following code is running twice:

    if use bpf ; then
        CONFIG_CHECK+="~BPF ~BPF_EVENTS ~BPF_SYSCALL ~DEBUG_INFO_BTF ~HAVE_EBPF_JIT"
    fi

On the second run this code results in ~HAVE_EBPF_JIT~BPF (without space in between) and this results in error:

> /var/tmp/portage/dev-util/perf-6.6/temp/environment: line 1479: ERROR_HAVE_EBPF_JIT~BPF: invalid variable name

To fix this issue CONFIG_CHECK needs to be defined as local variable:

    if use bpf ; then
        local CONFIG_CHECK+="~BPF ~BPF_EVENTS ~BPF_SYSCALL ~DEBUG_INFO_BTF ~HAVE_EBPF_JIT"
    fi

It is possible to use space before ~BPF, but then for binary package CONFIG_CHECK will check for these configs twice. So making local is better.
Comment 1 pva 2024-01-02 14:10:44 UTC
Created attachment 881265 [details]
build.log
Comment 2 pva 2024-01-02 14:11:13 UTC
Created attachment 881266 [details]
environment.xz
Comment 3 pva 2024-01-02 14:11:27 UTC
Created attachment 881267 [details]
emerge--info.txt
Comment 4 pva 2024-01-02 14:27:26 UTC
Created attachment 881268 [details, diff]
perf-6.6.ebuild.patch
Comment 5 Guilherme Amadio gentoo-dev 2024-01-02 16:05:19 UTC
I think making CONFIG_CHECK a local variable is not the right solution, because the tests are supposed to be appended to the pre-existing global variable. Making it local will just skip those checks. I think the right fix is to change the condition of the if statement so it runs only once.
Comment 6 pva 2024-01-03 09:14:35 UTC
Well, I've checked. It is passed correctly. But do we need to have CONFIG_CHECK global in the first place? I think it's better to move variable to pkg_setup().
Comment 7 pva 2024-01-03 09:14:53 UTC
Created attachment 881366 [details, diff]
perf-6.6.ebuild.patch
Comment 8 Larry the Git Cow gentoo-dev 2024-01-30 15:25:58 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=70d3e0e2fd20857968ba3ea7ddbf9292144b22ed

commit 70d3e0e2fd20857968ba3ea7ddbf9292144b22ed
Author:     Guilherme Amadio <amadio@gentoo.org>
AuthorDate: 2024-01-30 15:04:56 +0000
Commit:     Guilherme Amadio <amadio@gentoo.org>
CommitDate: 2024-01-30 15:25:34 +0000

    dev-util/perf: fix bugs #917559 and #921197
    
    Closes: https://bugs.gentoo.org/917559
    Closes: https://bugs.gentoo.org/921197
    
    Co-authored-by: Peter Volkov <peter.volkov@gmail.com>
    
    Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

 dev-util/perf/files/perf-6.7-expr.patch | 24 ++++++++++++++++++++++++
 dev-util/perf/perf-6.7.ebuild           | 33 +++++++++++++++++----------------
 2 files changed, 41 insertions(+), 16 deletions(-)