From: Yuri Kanivetsky <firstname.lastname@example.org>
Subject: [musl] What determines the TERM variable value?
Date: Fri, 11 Feb 2022 15:30:32 +0200 [thread overview]
Message-ID: <CAMhVC3bJy1CyRzJFoRwNAiWqAr9JF65ew6qOByG0M3AFefs94A@mail.gmail.com> (raw)
I was told recently that I can set TERM to any value inside a docker
container, which is, sort of, at odds with my understanding.
And my understanding is as follows. When a program creates a
pseudoterminal (a pty master/slave pair), it sort of becomes a
terminal emulator. I guess, it can decide not to process any escape
sequences in which case the pair is probably not much different from
an ordinary pipe. And basically what sequences it decides to process
determines the TERM variable value.
I can separate such programs into 2 categories:
* Terminal emulators (xterm, urxvt, ...). They receive input, process
escape sequences, and draw the result in a window. They can invent
their own language (escape sequences), but it's probably best to have
some terminal as a base.
* The rest (docker, ssh, tmux, screen, ...). They receive input,
translate escape sequences to the language of the process up the chain
(by using the TERM variable and the terminfo database), and pass the
result to stdout (text, optionally with translated escape sequences).
So, generally you have a chain of processes connected via
pseudoterminals (a pty master/slave pairs). E.g. xterm <-> ssh <->
tmux <-> docker.
Also, you can't set TERM to an arbitrary value. Each program that
creates a pseudoterminal supports a fixed set of values. E.g. the tmux
> For tmux to work correctly, this must be set to screen, tmux or a derivative of them.
Is my understanding correct?
Also, I have a pretty vague understanding of what the TERM variable
affects. Can you give some examples? Or categorize things in some way?
Is it only about escape sequences?
next reply other threads:[~2022-02-11 13:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 13:30 Yuri Kanivetsky [this message]
2022-02-11 15:54 ` Rich Felker
2022-02-12 9:34 ` Yuri Kanivetsky
2022-02-12 10:33 ` Markus Wichmann
2022-02-12 15:05 ` Rich Felker
2022-02-13 8:54 ` Yuri Kanivetsky
2022-02-13 9:57 ` Markus Wichmann
2022-02-17 20:37 ` [musl] RE: [EXTERNAL] " Andy Caldwell
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).