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

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