From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2307 invoked from network); 12 Feb 2022 10:34:12 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 12 Feb 2022 10:34:12 -0000 Received: (qmail 22079 invoked by uid 550); 12 Feb 2022 10:34:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 22042 invoked from network); 12 Feb 2022 10:34:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644662037; bh=jR4/0rD54mzlgFwuJnbNUeh/mU70wGXD8Ni73RKuLNM=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=Zj5CUVQ/3MlCT1v++qtovl/njw37yM5Yx9urtKLRtqFwqtUHkP4cQ8dhDX13p+0C8 7H4p7uH/9Es3yi99j7fISMGk0QEy1zVPDmaGa6csRBtrt2Fi6QJBz/k+fCWAQqc2g5 nIFRLv6eT15hgwcwglmv3sdKZm7yhdWszOKtio2I= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Date: Sat, 12 Feb 2022 11:33:56 +0100 From: Markus Wichmann To: musl@lists.openwall.com Message-ID: <20220212103356.GB8426@voyager> References: <20220211155441.GG7074@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-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A987UzzZfaDMR1/eg/EufvLY119zl6ItEGv+8v2GeUb1CV7zTceJ9UP H1wwSZIhcVykNo5EodlBO7I83Tnt3ToP/sAZ3dVTN8fMBy+LLgM/ByMyE0Acl9VEopJSSJ46q aj0GWeSQdWAVT0sO/h/mWpD1WuskHixCikwcwDsJrx7X79X/jY6w1U1RSanKZK4Uqh4aPd2Nt WptD62bduXmapPVEPUX4fyQeD67qCeJYzfyJdDptshjVsWB+7l0C5+K0qpD5p2e3m8eutCQW8 ZjanuqZfDF11sKZklFb+FJXkJ0IJRiSwxRta7cUXbnWOVy6/P4upg96gp1CWIiexNdYmUATvk EvdTaj1H/NcaWw= Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] What determines the TERM variable value? On Sat, Feb 12, 2022 at 11:34:52AM +0200, Yuri Kanivetsky wrote: > So, a program is a terminal emulator if it translates escape sequences > in both directions? And if it, as a result, changes the TERM variable? > A program is a terminal emulator if it emulates a terminal, i.e. provides an interface for TUI applications to interact with a keyboard and screen (and optionally a mouse). The Linux VT provides such a thing directly, X11 applications like xterm do so via the X11 protocol. Screen and tmux are men in the middle, implementing screen and keyboard via another terminal emulator. But still, they are terminal emulators. The TERM variable is not somehow especially protected. Any process can change it at any time, and it will remain changed for that process and any child processes until one of those decides to change it again. To wit: > What seems strange to me is that docker changes the TERM variable: > > $ echo $TERM > screen-256color > > $ docker run --rm -it alpine > / # echo $TERM > xterm > Anyone can change the TERM variable, including docker. I think, they assume that xterm is a least common denominator among terminal emulators. Also, the xterm terminfo is most likely to be installed in whatever container you are running. Leaving aside the technical meaning of the TERM variable, what it is used for most often is to find the terminfo database for the terminal. That is a file on the local file system, and must be installed to be effective. If, for example, I connect from my normal terminal emulator to a remote host via ssh, and I transmit a TERM variable of "stterm-256color", then this will not help the apps on the far side of the connection to figure out how to talk to my terminal if the stterm terminfo file is not installed. My options then are to install it or look for a terminfo file that is installed and sufficiently similar to my terminal to make it work. Likely shedding some features in the process (e.g. you can make almost anything work by setting TERM to vt100, but then you loose all colors). Similarly, it is nice for you to be using screen as a terminal in the host, but docker likely does not want to assume that the screen terminfo is installed in the container, and that is where it would need to be for the container to make any use of it. That said, docker is a highly flexible piece of software, so I would be surprised if this functionality was not configurable somehow. Ciao, Markus