]> git.ipfire.org Git - thirdparty/systemd.git/commit
exec: when we have no $TERM configuration, and we default to vt220, also set $COLORTERM
authorLennart Poettering <lennart@poettering.net>
Mon, 17 Mar 2025 08:34:49 +0000 (09:34 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 17 Mar 2025 09:15:51 +0000 (10:15 +0100)
commit728dbaeffb3e72872253c50ca5d1c100cc532634
tree700691ac4294f8d3691cf181b45916f0c7e5c168
parent58b33eee41ce8955e48420704f571c5141bf42e5
exec: when we have no $TERM configuration, and we default to vt220, also set $COLORTERM

When we configure a serial or VM terminal and have no $TERM
configuration, then we default to vt220 as a fallback. This is a pretty
safe bet, since the termcap/terminfo definitions for vt220 are
relatively widely available (much like vt100), and (in contrast to
vt100) it supports pageup/pagedown keys. vt220 is a terminal without
color support however, but we do want color support, because in 2025
there's really no terminal emulator without color in this world.

The $COLORTERM env var is used my many emulators and tools to
communicate that ANSI color support is available, despite what $TERM
says. Hence, let's tweak systemd's logic to also set $COLORTERM in case
we set the vt220 $TERM fallback.

This means we define an ahistoric frankenterminal: a vt220 (that
historically definitely didn't have color) that is explicitly configured
to have color.

One effect of this is that coreutils' dircolors command will start to
output color sequences in systemd's serial or VM terminals. (Since it
actually honours $COLORTERM).

Also note that systemd itself checks $COLORTERM since a long time, hence
it makes sense for us to also set it.

Note that this unfortunately doesn't have the desired effect of
propagating $COLORTERM into any getty shell sessions yet. That's because
util-linux' login package currently fiters $COLORTERM (but lets $TERM
though). I filed a bug about that here:

https://github.com/util-linux/util-linux/issues/3463
src/core/exec-invoke.c