Skip to contentSkip to conversation

Escape unprintable characters

RFC [email protected] 1 participant 1 message Sep 30, 2023

lore
Share & tools
lore
#0 lore raw

Hi all,

after watching "DEF CON 31 - Terminally Owned - 60 Years of Escaping - David Leadbeater" [1] I wrote this recipe to test our message behavior.

SUMMARY = "Test escape sequences"
DESCRIPTION = "Test escape sequences"
LICENSE = "MIT"

python do_compile() {
    bb.plain("\033[31;1;4mHello\033[0m\n");
}
do_install() {
    bbwarn "\033[31;1;4mHello\033[0m\n"
}

At least on my terminal it will print a red Hello with a newline.

Dmesg and sytemd both escape unprintable characters by default.
I propose that we should do the same.
We could still offer an option to just print those, for all people who want to have shiny color outputs.

As a second step we could even try to escape them before writing them to the logfile? This would help people who don't know about cat -v and so on?

What is your opinion about that?

Greets,
Bernhard