lkml.org 
[lkml]   [2020]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: perf script, libperf: python binding bug (bytearrays vs. strings)
* Jiri Olsa | 2020-09-28 12:08:08 [+0200]:

>patch below fixes it for me, but seems strange this was
>working till now.. maybe you're the only one using this
>with python3 ;-)

and I thought python2 is obsolete and not maintained anymore ... ;-)
Anyway, the patch fixed everything: no more garbage for Python2 and Python3
as well as no bytearray type Python3!

Tested-by: Hagen Paul Pfeifer <hagen@jauu.net>

Thank you Jiri!

Probably this patch should be applied on stable too!? Not sure when the
problem was introduced.

Hagen

>jirka
>
>
>---
>diff --git a/tools/perf/util/print_binary.c b/tools/perf/util/print_binary.c
>index 599a1543871d..13fdc51c61d9 100644
>--- a/tools/perf/util/print_binary.c
>+++ b/tools/perf/util/print_binary.c
>@@ -50,7 +50,7 @@ int is_printable_array(char *p, unsigned int len)
>
> len--;
>
>- for (i = 0; i < len; i++) {
>+ for (i = 0; i < len && p[i]; i++) {
> if (!isprint(p[i]) && !isspace(p[i]))
> return 0;
> }
>

\
 
 \ /
  Last update: 2020-09-28 12:43    [W:0.053 / U:1.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site