diff mbox

libbootmsg: Do not use '\b' characters when printing checkpoints

Message ID 1456304897-16488-1-git-send-email-thuth@redhat.com
State Accepted
Headers show

Commit Message

Thomas Huth Feb. 24, 2016, 9:08 a.m. UTC
Using backspaces after printing out the checkpoint numbers is fine
when printing to terminals. But if the output of SLOF is placed
into a log file instead, this can confuse certain readers like
Firefox to interpret the log file as a binary file instead of text.
To avoid this problem, we can also use '\r' to move the cursor
back to the beginning - this should be fine since the checkpoints
are always printed at the beginning of a line anyway. And '\r' is
then interpreted as normal text, not as a potential binary file byte.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 lib/libbootmsg/bootmsg_lvl.S | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Alexey Kardashevskiy Feb. 24, 2016, 9:29 a.m. UTC | #1
On 02/24/2016 08:08 PM, Thomas Huth wrote:
> Using backspaces after printing out the checkpoint numbers is fine
> when printing to terminals. But if the output of SLOF is placed
> into a log file instead, this can confuse certain readers like
> Firefox to interpret the log file as a binary file instead of text.
> To avoid this problem, we can also use '\r' to move the cursor
> back to the beginning - this should be fine since the checkpoints
> are always printed at the beginning of a line anyway. And '\r' is
> then interpreted as normal text, not as a potential binary file byte.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Thanks, applied.


> ---
>   lib/libbootmsg/bootmsg_lvl.S | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/lib/libbootmsg/bootmsg_lvl.S b/lib/libbootmsg/bootmsg_lvl.S
> index 2e4c135..14ce4bf 100644
> --- a/lib/libbootmsg/bootmsg_lvl.S
> +++ b/lib/libbootmsg/bootmsg_lvl.S
> @@ -58,10 +58,8 @@ ENTRY(bootmsg_cp)
>   	bl      io_putchar      // print character
>   	mr	r3, r9
>   	bl      io_printhex16   // print checkpoint ID
> -	.rept   5
> -	li      r3,'\b'
> -	bl      io_putchar      // print backspaces
> -	.endr
> +	li      r3,'\r'
> +	bl      io_putchar      // go back
>   	mtlr	r11
>   	blr
>
>
diff mbox

Patch

diff --git a/lib/libbootmsg/bootmsg_lvl.S b/lib/libbootmsg/bootmsg_lvl.S
index 2e4c135..14ce4bf 100644
--- a/lib/libbootmsg/bootmsg_lvl.S
+++ b/lib/libbootmsg/bootmsg_lvl.S
@@ -58,10 +58,8 @@  ENTRY(bootmsg_cp)
 	bl      io_putchar      // print character
 	mr	r3, r9
 	bl      io_printhex16   // print checkpoint ID
-	.rept   5
-	li      r3,'\b'
-	bl      io_putchar      // print backspaces
-	.endr
+	li      r3,'\r'
+	bl      io_putchar      // go back
 	mtlr	r11
 	blr