]> git.ipfire.org Git - thirdparty/systemd.git/commit
terminal-util: change conditioning in terminal_reset_defensive()
authorLennart Poettering <lennart@poettering.net>
Fri, 31 Jan 2025 14:32:01 +0000 (15:32 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 27 Feb 2025 14:17:34 +0000 (15:17 +0100)
commit5b3eaf9e680d98e5247bd0af16afc004cca1d754
treedd5f11e44f29d6eae5c2ab7aa037fd0307456467
parent9ab703d8e13da560bd04c2692c0faa7a76cebf33
terminal-util: change conditioning in terminal_reset_defensive()

So far we conditioned the logic that issues ansi sequences for resetting
the TTY based on whether something is a pty is not (under the assumption
we need no reset on ptys, since they are shortlived).

This is simply wrong though. The pty that a container getty is invoked
on is generally long-lived: as long as the container is up, and it will
be reused between getty instances/sessions all the time. In such a case
we really should reset properly.

Let's instead make the logic dependent on whether TERM is set to
anything other than "dumb". The previous commit made sure we always set
TERM in a sensible way in systemd-run, hence this
*explicit* logic sounds like a much better choice now, as it mea
src/basic/terminal-util.c
src/basic/terminal-util.h
src/core/exec-invoke.c
src/core/execute.c
src/core/execute.h