commit:     a77ba80e013b62ca44a3123167aa3ee376e7faeb
Author:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 10 12:08:22 2025 +0000
Commit:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Thu Dec 11 14:19:59 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a77ba80e

dev-util/perf: apply fix for --help option and help command

Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>

 dev-util/perf/files/perf-6.18-subcmd.patch         | 27 ++++++++++++++++++++++
 .../perf/{perf-6.18.ebuild => perf-6.18-r1.ebuild} |  1 +
 2 files changed, 28 insertions(+)

diff --git a/dev-util/perf/files/perf-6.18-subcmd.patch 
b/dev-util/perf/files/perf-6.18-subcmd.patch
new file mode 100644
index 000000000000..e3e067efdd07
--- /dev/null
+++ b/dev-util/perf/files/perf-6.18-subcmd.patch
@@ -0,0 +1,27 @@
+Fix for --help command when no commands are excluded.
+
+Link: 
https://lore.kernel.org/lkml/[email protected]/
+
+See also: https://lore.kernel.org/lkml/[email protected]/
+
+--- a/tools/lib/subcmd/help.c
++++ b/tools/lib/subcmd/help.c
+@@ -97,11 +97,13 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames 
*excludes)
+                       ei++;
+               }
+       }
+-      if (ci != cj) {
+-              while (ci < cmds->cnt) {
+-                      cmds->names[cj++] = cmds->names[ci];
+-                      cmds->names[ci++] = NULL;
++      while (ci < cmds->cnt) {
++              if (ci != cj) {
++                      cmds->names[cj] = cmds->names[ci];
++                      cmds->names[ci] = NULL;
+               }
++              ci++;
++              cj++;
+       }
+       for (ci = cj; ci < cmds->cnt; ci++)
+               assert(cmds->names[ci] == NULL);
+-- 

diff --git a/dev-util/perf/perf-6.18.ebuild b/dev-util/perf/perf-6.18-r1.ebuild
similarity index 99%
rename from dev-util/perf/perf-6.18.ebuild
rename to dev-util/perf/perf-6.18-r1.ebuild
index 584037462fc0..eef384583894 100644
--- a/dev-util/perf/perf-6.18.ebuild
+++ b/dev-util/perf/perf-6.18-r1.ebuild
@@ -177,6 +177,7 @@ src_prepare() {
 
        pushd "${S_K}" >/dev/null || die
        # Gentoo patches go here
+       eapply "${FILESDIR}/${P}-subcmd.patch"
        popd || die
 
        # Drop some upstream too-developer-oriented flags and fix the

Reply via email to