#875439 buildd.debian.org: please support ANSI color in HTML output

#875439#5
Date:
2017-09-11 12:35:03 UTC
From:
To:
Hi!
A lot of software colorizes their build logs.  This makes reading them
massively more convenient: to find the error, instead of poring through
20 pages of text, you wiggle the scrollbar for a second and watch for the
flash of red.

Most such software disables colors when redirected (ie, when !isatty(1) or
[ ! -t 1 ]), but around 2% does so unconditionally, this results in raw ANSI
codes in the HTML.  They should be either supported or at the very least
filtered out.

Thus, please pipe the logs through "ansi2html -nw" (package colorized-logs).
It has an extra benefit of replacing unprintable characters, such as
backspace (replaced with ⌫)[1], unpaired \r (↵), \a (♪) or \l (<hr>).

The package is available in stretch, jessie-backports and buster.  The
version in stretch/jessie-bpo uses unmodified VGA palette which has a
downside of making bright yellow on white very hard to read (Java stuff
loves bright yellow) -- this is accurate as same happens on a real terminal
with a white background; the version in buster fudges yellow to be less
accurate and more readable.  Another solution would be switching to a
on-black/on-dark scheme like Travis[3] does, but this is a matter of taste.

If you insist for keeping strict plaintext-in-HTML, then you'd want ansi2txt
instead.


Meow!

[1] It's debatable whether \b or \r should be printed or erase text;
ansi2html opts to be strictly hardcopy so no information is lost[2].
[2] Ok, ok, you can't tell a replaced U+0007 from U+266A, but hey.
[3] I guess that upstreams look at Travis drastically more often than
at our build logs; this also explains the large uptick of colored logs.

#875439#10
Date:
2018-05-27 22:39:54 UTC
From:
To:
The version in unstable[1] has just grown an option to make sure there's no
white on white.  That would happen if a log requests explicit "white" rather
than "bold".  Same applies to black-on-black or pink-on-pink.

I didn't make this the default for generic use (as it's not what real
terminals do), but you don't care about accuracy but not losing information.
Thus, it'd be nice if you could filter the logs through "ansi2html -nwc".


Meow!

[1]. Which, if you approve this idea, can get to stretch-bpo.

#875439#15
Date:
2026-07-09 06:55:42 UTC
From:
To:
发自我的 iPhone