Blame SOURCES/bcc-0.19.0-Fix-BPF-src_file-foo.patch

f5a3df
From 9051043a126a838902b88d144eea1b631d2c3eef Mon Sep 17 00:00:00 2001
f5a3df
From: Jerome Marchand <jmarchan@redhat.com>
f5a3df
Date: Tue, 27 Apr 2021 15:13:12 +0200
f5a3df
Subject: [PATCH] Fix BPF(src_file="foo")
f5a3df
f5a3df
Since commit 75f20a15 ("Use string type for comparison to PATH
f5a3df
elements"), src_file isn't working anymore. Somehow, two wrongs
f5a3df
(ArgString __str__() returning a bytes object and joining a bytes and
f5a3df
what was supposed to be a string) did make a right.
f5a3df
f5a3df
It fixes the following error in netqtop and deadlock:
f5a3df
Traceback (most recent call last):
f5a3df
  File "/usr/share/bcc/tools/netqtop", line 207, in <module>
f5a3df
    b = BPF(src_file = EBPF_FILE)
f5a3df
  File "/usr/lib/python3.6/site-packages/bcc/__init__.py", line 335, in __init__
f5a3df
    src_file = BPF._find_file(src_file)
f5a3df
  File "/usr/lib/python3.6/site-packages/bcc/__init__.py", line 255, in _find_file
f5a3df
    t = b"/".join([os.path.abspath(os.path.dirname(argv0.__str__())), filename])
f5a3df
TypeError: sequence item 0: expected a bytes-like object, str found
f5a3df
---
f5a3df
 src/python/bcc/__init__.py | 2 +-
f5a3df
 1 file changed, 1 insertion(+), 1 deletion(-)
f5a3df
f5a3df
diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py
f5a3df
index 90562cd7..eabe0a55 100644
f5a3df
--- a/src/python/bcc/__init__.py
f5a3df
+++ b/src/python/bcc/__init__.py
f5a3df
@@ -252,7 +252,7 @@ DEBUG_BTF = 0x20
f5a3df
         if filename:
f5a3df
             if not os.path.isfile(filename):
f5a3df
                 argv0 = ArgString(sys.argv[0])
f5a3df
-                t = b"/".join([os.path.abspath(os.path.dirname(argv0.__str__())), filename])
f5a3df
+                t = b"/".join([os.path.abspath(os.path.dirname(argv0.__bytes__())), filename])
f5a3df
                 if os.path.isfile(t):
f5a3df
                     filename = t
f5a3df
                 else:
f5a3df
-- 
f5a3df
2.30.2
f5a3df