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

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