Skip to content

Commit c50db02

Browse files
authored
*.py: fix incorrect regex escaping (#4961)
Fixes #4959
1 parent c0e9b56 commit c50db02

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Diff for: examples/tracing/task_switch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from time import sleep
77

88
b = BPF(src_file="task_switch.c")
9-
b.attach_kprobe(event_re=r'^finish_task_switch$|^finish_task_switch.isra.d$',
9+
b.attach_kprobe(event_re=r'^finish_task_switch$|^finish_task_switch\.isra\.\d$',
1010
fn_name="count_sched")
1111

1212
# generate many schedule events

Diff for: src/python/bcc/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ def get_kprobe_functions(event_re):
755755
elif fn.startswith(b'__SCT__'):
756756
continue
757757
# Exclude all gcc 8's extra .cold functions
758-
elif re.match(b'^.*.cold(.d+)?$', fn):
758+
elif re.match(br'^.*\.cold(\.\d+)?$', fn):
759759
continue
760760
if (t.lower() in [b't', b'w']) and re.fullmatch(event_re, fn) \
761761
and fn not in blacklist \

Diff for: tests/python/test_trace2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TestTracingEvent(TestCase):
3131
def setUp(self):
3232
b = BPF(text=text, debug=0)
3333
self.stats = b.get_table(b'stats')
34-
b.attach_kprobe(event_re=b'^finish_task_switch$|^finish_task_switch.isra.d$',
34+
b.attach_kprobe(event_re=b'^finish_task_switch$|^finish_task_switch\.isra\.\d$',
3535
fn_name=b'count_sched')
3636

3737
def test_sched1(self):

Diff for: tools/exitsnoop.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def initialize(arg_list = sys.argv[1:]):
204204
Global.args.timestamp = True
205205
if not Global.args.ebpf and os.geteuid() != 0:
206206
return (os.EX_NOPERM, "Need sudo (CAP_SYS_ADMIN) for BPF() system call")
207-
if re.match(r'^3.10..*el7.*$', platform.release()): # Centos/Red Hat
207+
if re.match(r'^3\.10\..*el7.*$', platform.release()): # Centos/Red Hat
208208
Global.args.timespec = True
209209
for _ in range(2):
210210
c = _embedded_c(Global.args)

0 commit comments

Comments
 (0)