commit:     50670caaa53996278d760a7c4b4d8f9586500dd7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 22 03:26:04 2025 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Oct 22 03:29:49 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50670caa

dev-util/bcc: fix dirname $0 in tools

Closes: https://bugs.gentoo.org/964734
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 dev-util/bcc/bcc-0.31.0-r2.ebuild | 3 ++-
 dev-util/bcc/bcc-0.32.0.ebuild    | 1 +
 dev-util/bcc/bcc-0.34.0.ebuild    | 1 +
 dev-util/bcc/bcc-0.35.0.ebuild    | 1 +
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dev-util/bcc/bcc-0.31.0-r2.ebuild 
b/dev-util/bcc/bcc-0.31.0-r2.ebuild
index 5fc842517bec..97de0a8ce17b 100644
--- a/dev-util/bcc/bcc-0.31.0-r2.ebuild
+++ b/dev-util/bcc/bcc-0.31.0-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -193,6 +193,7 @@ src_install() {
        for tool in "${ED}"/usr/share/bcc/tools/*; do
                [[ -d ${tool} || ! -x ${tool} || ${tool} =~ .*[.](c|txt) ]] && 
continue
                grep -qE '^#!/usr/bin/(env |)python' "${tool}" && continue
+               sed -e 's:dirname \$0:dirname "$(realpath "$0")":' -i "${tool}" 
|| die
 
                target="/usr/sbin/$(bcc_tool_name "${tool}")"
                [[ -e ${ED}${target} ]] && continue

diff --git a/dev-util/bcc/bcc-0.32.0.ebuild b/dev-util/bcc/bcc-0.32.0.ebuild
index 49b66101e088..ef4eddac9954 100644
--- a/dev-util/bcc/bcc-0.32.0.ebuild
+++ b/dev-util/bcc/bcc-0.32.0.ebuild
@@ -193,6 +193,7 @@ src_install() {
        for tool in "${ED}"/usr/share/bcc/tools/*; do
                [[ -d ${tool} || ! -x ${tool} || ${tool} =~ .*[.](c|txt) ]] && 
continue
                grep -qE '^#!/usr/bin/(env |)python' "${tool}" && continue
+               sed -e 's:dirname \$0:dirname "$(realpath "$0")":' -i "${tool}" 
|| die
 
                target="/usr/sbin/$(bcc_tool_name "${tool}")"
                [[ -e ${ED}${target} ]] && continue

diff --git a/dev-util/bcc/bcc-0.34.0.ebuild b/dev-util/bcc/bcc-0.34.0.ebuild
index b8d98a3ce42e..6e54c68eed63 100644
--- a/dev-util/bcc/bcc-0.34.0.ebuild
+++ b/dev-util/bcc/bcc-0.34.0.ebuild
@@ -193,6 +193,7 @@ src_install() {
        for tool in "${ED}"/usr/share/bcc/tools/*; do
                [[ -d ${tool} || ! -x ${tool} || ${tool} =~ .*[.](c|txt) ]] && 
continue
                grep -qE '^#!/usr/bin/(env |)python' "${tool}" && continue
+               sed -e 's:dirname \$0:dirname "$(realpath "$0")":' -i "${tool}" 
|| die
 
                target="/usr/sbin/$(bcc_tool_name "${tool}")"
                [[ -e ${ED}${target} ]] && continue

diff --git a/dev-util/bcc/bcc-0.35.0.ebuild b/dev-util/bcc/bcc-0.35.0.ebuild
index ce25ce02b235..ea3e6f59636a 100644
--- a/dev-util/bcc/bcc-0.35.0.ebuild
+++ b/dev-util/bcc/bcc-0.35.0.ebuild
@@ -193,6 +193,7 @@ src_install() {
        for tool in "${ED}"/usr/share/bcc/tools/*; do
                [[ -d ${tool} || ! -x ${tool} || ${tool} =~ .*[.](c|txt) ]] && 
continue
                grep -qE '^#!/usr/bin/(env |)python' "${tool}" && continue
+               sed -e 's:dirname \$0:dirname "$(realpath "$0")":' -i "${tool}" 
|| die
 
                target="/usr/sbin/$(bcc_tool_name "${tool}")"
                [[ -e ${ED}${target} ]] && continue

Reply via email to