lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 5 May 2016 10:20:55 -0400
From:	Dom Cote <buzdelabuz2@...il.com>
To:	Kieran Bingham <kieran@...uared.org.uk>
Cc:	"J. Kiszka" <jan.kiszka@...mens.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts/gdb: decode bytestream on dmesg for Python3

Looks good, b'<text>' marker doesn't appear anymore.
Tested for python 2.7 and 3.4

Acked-by:  Dom Cote <buzdelabuz2@...il.com>
Tested-by: Dom Cote <buzdelabuz2@...il.com>

Regards

On Wed, May 4, 2016 at 8:37 AM, Kieran Bingham <kieran@...gham.xyz> wrote:
> The recent fixes to lx-dmesg, now allow the command to print
> successfully on Python3, however the python interpreter wraps the bytes
> for each line with a b'<text>' marker.
>
> To remove this, we need to decode the line, where .decode() will default
> to 'UTF-8'
>
> Signed-off-by: Kieran Bingham <kieran@...gham.xyz>
> ---
>  scripts/gdb/linux/dmesg.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py
> index 04d6719067f2..f9b92ece7834 100644
> --- a/scripts/gdb/linux/dmesg.py
> +++ b/scripts/gdb/linux/dmesg.py
> @@ -51,10 +51,10 @@ class LxDmesg(gdb.Command):
>                  continue
>
>              text_len = utils.read_u16(log_buf[pos + 10:pos + 12])
> -            text = log_buf[pos + 16:pos + 16 + text_len]
> +            text = log_buf[pos + 16:pos + 16 + text_len].decode()
>              time_stamp = utils.read_u64(log_buf[pos:pos + 8])
>
> -            for line in memoryview(text).tobytes().splitlines():
> +            for line in text.splitlines():
>                  gdb.write("[{time:12.6f}] {line}\n".format(
>                      time=time_stamp / 1000000000.0,
>                      line=line))
> --
> 2.5.0
>

Powered by blists - more mailing lists