From a2f765b72a6612758a034a5b0c24ec08625db1a3 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 12 May 2023 14:55:55 +0200 Subject: slave: unset TERM_PROGRAM{,_VERSION} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Foot’s policy is to not set environment variables that identifies it (except the well-known and established `TERM` variable). We encourage applications to use terminfo to determine capabilities, or terminal queries, when available. Or, at least use terminal queries to detect the terminal and its version. Setting environment variables is a bad idea since they are inherited by all applications started by the terminal (which is the whole point). But, this includes other terminal emulators, making it very possible a terminal emulator gets mis-detected just because it was started from another terminal. Since there are a couple of terminal emulators that _do_ set TERM_PROGRAM and TERM_PROGRAM_VERSION, unset these environment variables to avoid being misdetected. Closes #1349 --- slave.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'slave.c') diff --git a/slave.c b/slave.c index 2f23e996..ecfce7e6 100644 --- a/slave.c +++ b/slave.c @@ -21,7 +21,6 @@ #include "macros.h" #include "terminal.h" #include "tokenize.h" -#include "version.h" #include "xmalloc.h" extern char **environ; @@ -352,11 +351,12 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv, } setenv("TERM", term_env, 1); - setenv("TERM_PROGRAM", "foot", 1); - setenv("TERM_PROGRAM_VERSION", FOOT_VERSION_SHORT, 1); setenv("COLORTERM", "truecolor", 1); setenv("PWD", cwd, 1); + unsetenv("TERM_PROGRAM"); + unsetenv("TERM_PROGRAM_VERSION"); + #if defined(FOOT_TERMINFO_PATH) setenv("TERMINFO", FOOT_TERMINFO_PATH, 1); #endif -- cgit v1.3