Re: [PATCH v3] scripts/decodecode: fix faulting instruction no print when opps.file is DOS format

From: Borislav Petkov
Date: Thu Sep 30 2021 - 08:20:07 EST


On Thu, Sep 30, 2021 at 10:04:39AM +0800, unknown wrote:
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

You don't just add Signed-off-by of other people when sending a patch -
please don't *ever* do that.

If you don't know what you're doing, *don't* do it but *read* the damn
docs first:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html

> Cc: Marc Zyngier <maz@xxxxxxxxxxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> Cc: Rabin Vincent <rabin@xxxxxx>
> Cc: lkml <linux-kernel@xxxxxxxxxxxxxxx>
> Signed-off-by: weidonghui <weidonghui@xxxxxxxxxxxxxxxxx>
> ---
> scripts/decodecode | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/decodecode b/scripts/decodecode
> index 31d884e35f2f..77a3b518aacc 100755
> --- a/scripts/decodecode
> +++ b/scripts/decodecode
> @@ -126,7 +126,7 @@ if [ $marker -ne 0 ]; then
> fi
> echo Code starting with the faulting instruction > $T.aa
> echo =========================================== >> $T.aa
> -code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g; s/[>)]$//'`
> +code=`echo $code | sed -e 's/\x0d//;s/ [<(]/ /;s/[>)] / /;s/ /,0x/g; s/[>)]$//'`

So that link I pointed you to says:

"That character is matched with \r by sed. Use:

sed -e "s/\r//g" input-file"

I have no clue how you did not see it?!

But I guess \x0d works too.

To quote from the sed info manual:

"5.8 Escape Sequences - specifying special characters
====================================================

...

'\r'
Produces or matches a carriage return (ASCII 13).

...

'\xXX'
Produces or matches a character whose hexadecimal ASCII value is
XX."

In any case, I'd prefer \r because it is more readable.

Thx.

--
Regards/Gruss,
Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg