Bug#672361: bootlogd: escape sequences should be filtered out

Jesse Smith jsmith at resonatingmedia.com
Thu Aug 8 23:24:23 BST 2019

On Thu, 08 Aug 2019 20:21:50 +0000 Dmitry Bogatov wrote:
> control: tags -1 +upstream
> [2019-08-07 05:13] Adam Borowski
> > [...]
> > > a /var/log/boot.log file is
> > > generated where nothing is filtered out, so that the file is readable
> > > with "cat" or "less" (and text is colored).
> >
> > I don't think files in /var/log/ should be anything but plain text -- at
> > least unless colorized-logs becomes essential :รพ and/or less defaults to
> > -R. But until a solution is implemented, I agree that leaving binaryish
> > control codes intact is better than corrupting them.
> Jesse, there seems to be demand on turning-off escape sequence filtering
> in bootlogd. Can you please make it configurable?

It is pretty easy to make an option for printing the escape sequences to
the log file. This will allow tools like "less" to print the boot log
with its colour codes.

I'd like to point out though that with such an option enabled, it is
going to result in some weird output. If all escape sequences are
printed to the file, tools like "less" can handle it, but other (more
raw) text manipulation tools such as "head" and "tail" will end up
mangling the lines. This is partly because escape characters include
positional instructions like '\r' for carriage-return.

In other words, if we make the boot log completely unfiltered, lines in
"less" will display properly, but using "cat", "head" or "tail" will
result in mangled lines that look like this:

Thu Aug 8 19:06:30 2019:
[ ok ug 8 19:06:30 2019: [... starting ]

I'm not sure we want to do that. Perhaps the ideal would be a small
degree of filtering to remove the positional control characters (like
'\r') while leaving the rest in to allow for colour to be displayed?

- Jesse

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/attachments/20190808/45990f64/attachment.html>

More information about the Debian-init-diversity mailing list