After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 630861 - Embedded Terminal Emulator isn't giving a TERM variable
Embedded Terminal Emulator isn't giving a TERM variable
Status: RESOLVED DUPLICATE of bug 631589
Product: vte
Classification: Core
Component: general
0.26.x
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
fixed-0-26
Depends on:
Blocks:
 
 
Reported: 2010-09-28 22:43 UTC by Julien Lavergne
Modified: 2010-10-17 10:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
set TERM variable on terminal initialization (959 bytes, patch)
2010-10-07 14:34 UTC, Mathieu Trudel-Lapierre
rejected Details | Review

Description Julien Lavergne 2010-09-28 22:43:22 UTC
Forwarded from Ubuntu : https://bugs.launchpad.net/ubuntu/+source/vte/+bug/621927

Environnement TERM is not set properly in embedded Terminal. Running any command line program (like top or nano) generate an error "TERM environment variable not set" or "Error opening terminal: unknown."

It's affect many terminal build with VTE (awn terminal, lxterminal, guake etc ...).

Last version 0.26 is affected, under Ubuntu Maverick (10.10).
Comment 1 Christian Persch 2010-09-28 23:00:57 UTC
Not reproducible with gnome-terminal 2.32.0.
Comment 2 texstar 2010-09-30 13:00:54 UTC
gnome-terminal 2.32.0 works fine but it breaks other terminal programs that depend on vte-devel as part of their build process such as

lxterminal
sakura
guake
terminal

Breakage occurred after vte 24.3.
Comment 3 Ionut Biru 2010-10-01 11:06:42 UTC
seems that this commit broke it:

http://git.gnome.org/browse/vte/commit/?h=vte-0-26&id=0574bcfbd5c5925458ecdea0e6bbac6d65e30efc
Comment 4 texstar 2010-10-01 12:55:58 UTC
I backed out the commit as a test but still getting this error if I type top in lxterminal, sakura, terminal etc...

[texstar@localhost ~]$ top
TERM environment variable not set.

I can type in the terminal
TERM=xterm
export TERM

or 

TERM=linux
export TERM

then top will run in said terminals.
Comment 5 texstar 2010-10-01 13:10:15 UTC
Just a quick follow up. With vte 0.24.3 installed I get in lxterminal

[texstar@localhost ~]$ printenv TERM
xterm

with vte 0.26.0 I get nothing.

[texstar@localhost ~]$ printenv TERM
[texstar@localhost ~]$
Comment 6 Kevin Fenzi 2010-10-01 18:56:09 UTC
Yeah, this breaks Xfce's Terminal as well. 

See: https://bugzilla.redhat.com/show_bug.cgi?id=639280

(along with roxterm, lxterminal, and likely many others). 

What was the reason for this commit? Can we get it reverted?
Comment 7 Christian Persch 2010-10-01 18:58:30 UTC
Comment 4 says the referenced commit doesn't cause this.

I still can't repro this in either gnome-terminal or vteapp.
Comment 8 texstar 2010-10-01 19:19:04 UTC
My work around for vte 0.26.0 for now is to edit my /etc/environment file and add

TERM=xterm

Not sure how this will affect my system elsewhere but it fixes all of my terminals that depend on vte.
Comment 9 Kevin Fenzi 2010-10-01 19:22:45 UTC
I reverted that commit and did a build and it sure seems to fix roxterm and Xfce Terminal here. 

Fedora scratch build at: 
http://koji.fedoraproject.org/koji/taskinfo?taskID=2506797


diff -Nur vte-0.26.0.orig/src/vte.c vte-0.26.0/src/vte.c
--- vte-0.26.0.orig/src/vte.c	2010-09-26 12:34:04.000000000 -0600
+++ vte-0.26.0/src/vte.c	2010-10-01 13:06:21.994294036 -0600
@@ -3518,32 +3518,6 @@
         return argv2;
 }
 
-/*
- * _vte_terminal_filter_envv:
- * @envv: the environment vector
- *
- * Filters out the TERM variable from @envv.
- *
- * Returns: (transfer container): the filtered environment vector
- */
-static char **
-_vte_terminal_filter_envv (char **envv)
-{
-  GPtrArray *array;
-  int i;
-
-  if (envv == NULL)
-    return NULL;
-
-  array = g_ptr_array_sized_new (g_strv_length (envv));
-  for (i = 0; envv[i]; ++i)
-    if (!g_str_has_prefix (envv[i], "TERM="))
-      g_ptr_array_add (array, envv[i]);
-  g_ptr_array_add (array, NULL);
-
-  return (char **) g_ptr_array_free (array, FALSE);
-}
-
 /**
  * vte_terminal_fork_command:
  * @terminal: a #VteTerminal
@@ -3580,7 +3554,7 @@
                           gboolean utmp,
                           gboolean wtmp)
 {
-        char **real_argv, **real_envv;
+        char **real_argv;
         GSpawnFlags spawn_flags;
         GPid child_pid;
         gboolean ret;
@@ -3596,19 +3570,17 @@
         spawn_flags = G_SPAWN_CHILD_INHERITS_STDIN |
                       G_SPAWN_SEARCH_PATH;
         real_argv = _vte_terminal_get_argv (command, argv, &spawn_flags);
-        real_envv = _vte_terminal_filter_envv (envv);
 
         ret = vte_terminal_fork_command_full(terminal,
                                              __vte_pty_get_pty_flags(lastlog, utmp, wtmp),
                                              working_directory,
                                              real_argv,
-                                             real_envv,
+                                             envv,
                                              spawn_flags,
                                              NULL, NULL,
                                              &child_pid,
                                              err);
         g_strfreev (real_argv);
-        g_free (real_envv);
 
 #ifdef VTE_DEBUG
         if (error) {

I'm really not sure why, but the revert seems to work here. 

Texstar: Can you try again reverting it and confirm it does or does not fix it for you?
Comment 10 texstar 2010-10-01 19:28:02 UTC
Ok. I will try it again. Thanks.

Tex
Comment 11 Ionut Biru 2010-10-01 19:42:42 UTC
i have the confirmation here: https://bugs.archlinux.org/task/21007
Comment 12 texstar 2010-10-01 21:08:04 UTC
I'm still getting nothing here with the reverted patch darn it. I'm not a coder but it seems to me maybe a fix would be to set envv to xterm if it equals NULL.  

if (envv == NULL)
   return NULL;

I'm curious now to see if the reverted patch works for Ubuntu.
Comment 13 Julien Lavergne 2010-10-01 21:13:47 UTC
I don't think reverting the commit http://git.gnome.org/browse/vte/commit/?h=vte-0-26&id=0574bcfbd5c5925458ecdea0e6bbac6d65e30efc will do anything. The bug was confirmed on Ubuntu for 0.25.91 and 0.26, and this commit was introduce between the 2 versions.
Comment 14 Ulf Winkelvos 2010-10-03 00:37:48 UTC
bisected and isolated the bug to commit: http://git.gnome.org/browse/vte/commit/?id=dd08c50c6a6dd4349d3cbce271ddf4b741db8861

previous revisions work fine with guake on x86_64. anything after this does not. It's a pretty big commit and contains probably pretty fundamental changes.
Comment 15 Mathieu Trudel-Lapierre 2010-10-07 14:34:42 UTC
Created attachment 171897 [details] [review]
set TERM variable on terminal initialization

The difference with gnome-terminal (and probably vteapp as well), is that they define TERM as xterm no matter what happens... On the other hand it looks like many terminal programs (or at least those affected), just do not touch TERM, probably relying on vte to set it. Gnome in general does not seem to pass the TERM environment variable when launching programs from the menus at least.

My take is that VTE should at least specify TERM if unset when a vte_terminal is initialized.
Comment 16 Christian Persch 2010-10-07 14:37:39 UTC
Comment on attachment 171897 [details] [review]
set TERM variable on terminal initialization

This 'patch' is a bad joke, right?
Comment 17 Behdad Esfahbod 2010-10-07 18:29:52 UTC

*** This bug has been marked as a duplicate of bug 631589 ***
Comment 18 texstar 2010-10-17 02:42:20 UTC
vte 0.26.1 has fixed the problem for me. Thank you gnome devs!