Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert bytes to string for re in get_tracepoints() #2318

Merged
merged 1 commit into from
Apr 18, 2019

Conversation

lcp
Copy link
Contributor

@lcp lcp commented Apr 17, 2019

When executing funccount with python3, the following error showed.

python3 funccount.py -D 't:block:*'

Traceback (most recent call last):
File "funccount.py", line 299, in
Tool().run()
File "funccount.py", line 261, in run
self.probe.load()
File "funccount.py", line 191, in load
bpf_text += self._generate_functions(trace_count_text)
File "funccount.py", line 143, in _generate_functions
tracepoints = BPF.get_tracepoints(self.pattern)
File "/usr/lib/python3.7/site-packages/bcc/init.py", line 772, in get_tracepoints
if re.match(tp_re, tp):
File "/usr/lib64/python3.7/re.py", line 173, in match
return _compile(pattern, flags).match(string)
TypeError: cannot use a bytes pattern on a string-like object

This commit convert 'tp_re' from bytes to string to avoid the crash.

Signed-off-by: Gary Lin [email protected]

When executing funccount with python3, the following error showed.

 # python3 funccount.py -D 't:block:*'
 Traceback (most recent call last):
   File "funccount.py", line 299, in <module>
     Tool().run()
   File "funccount.py", line 261, in run
     self.probe.load()
   File "funccount.py", line 191, in load
     bpf_text += self._generate_functions(trace_count_text)
   File "funccount.py", line 143, in _generate_functions
     tracepoints = BPF.get_tracepoints(self.pattern)
   File "/usr/lib/python3.7/site-packages/bcc/__init__.py", line 772, in get_tracepoints
     if re.match(tp_re, tp):
   File "/usr/lib64/python3.7/re.py", line 173, in match
     return _compile(pattern, flags).match(string)
 TypeError: cannot use a bytes pattern on a string-like object

This commit convert 'tp_re' from bytes to string to avoid the crash.

Signed-off-by: Gary Lin <[email protected]>
@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

@palmtenor palmtenor merged commit c36f5bf into iovisor:master Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants