[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb6751a5-4a14-01b9-785f-48bfa67d2c89@siemens.com>
Date: Fri, 23 Jun 2017 18:02:43 +0200
From: Jan Kiszka <jan.kiszka@...mens.com>
To: Leonard Crestez <leonard.crestez@....com>,
Kieran Bingham <kieran@...uared.org.uk>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] scripts/gdb: lx-dmesg: Use errors=replace for
decoding
On 2017-06-23 16:20, Leonard Crestez wrote:
> It is never desirable lx-dmesg to fail on string decoding errors, not
> even if the log buffer is corrupt.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@....com>
> ---
> 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 6f8d2b2..d0cac58 100644
> --- a/scripts/gdb/linux/dmesg.py
> +++ b/scripts/gdb/linux/dmesg.py
> @@ -52,13 +52,13 @@ 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].decode()
> + text = log_buf[pos + 16:pos + 16 + text_len].decode(errors='replace')
pep8 should complain.
> time_stamp = utils.read_u64(log_buf[pos:pos + 8])
>
> for line in text.splitlines():
> gdb.write("[{time:12.6f}] {line}\n".format(
> time=time_stamp / 1000000000.0,
> - line=line))
> + line=line.encode(errors='replace')))
You only talk about "decoding" in the commit log, but here you encode
back. An short explanation why this is also needed would be nice.
>
> pos += length
>
>
Jan
--
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
Powered by blists - more mailing lists