Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guake is not setting/exporting the TERM variable properly #341

Closed
behrangsa opened this issue Jul 5, 2014 · 9 comments
Closed

Guake is not setting/exporting the TERM variable properly #341

behrangsa opened this issue Jul 5, 2014 · 9 comments

Comments

@behrangsa
Copy link

I am not behind my Linux machine so I might miss some of the details now, but in short some programs depend on the TERM variable to be exported and have a reasonable/meaningful value, but under Guake they complain that TERM is not set.

I think the issue is similar to this Launchpad bug

@gsemet
Copy link
Member

gsemet commented Jul 11, 2014

guake is exporting $TERM in my environment:

$ echo $TERM                                                                                                                                                                         
xterm-256color

@pypingou
Copy link
Member

It looks like this fix does not work properly, in my guake:

$ echo $TERM                                          
xterm
$ grep xterm /usr/lib64/python2.7/site-packages/guake/main.py
    # Force to xterm-256 colors for compatibility with some old command line programs
    os.environ["TERM"] = "xterm-256color"

Could it be setting the environment variable for within the program but not in the terms emulated?

@pypingou pypingou reopened this Jun 15, 2015
@gsemet
Copy link
Member

gsemet commented Jun 15, 2015

Are you sure you don't have something in your .bashrc or .profile?

@dayer3
Copy link

dayer3 commented Jun 15, 2015

I've the same problem.

My .bashrc:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions

My .bash_profile:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

if [ -z "$SSH_AUTH_SOCK" ] ; then
  eval `ssh-agent -s`
  ssh-add
fi

My /etc/bashrc:

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

# are we an interactive shell?
if [ "$PS1" ]; then
  if [ -z "$PROMPT_COMMAND" ]; then
    case $TERM in
    xterm*|vte*)
      if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
      elif [ "${VTE_VERSION:-0}" -ge 3405 ]; then
          PROMPT_COMMAND="__vte_prompt_command"
      else
          PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
      fi
      ;;
    screen*)
      if [ -e /etc/sysconfig/bash-prompt-screen ]; then
          PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
      else
          PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
      fi
      ;;
    *)
      [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
      ;;
    esac
  fi
  # Turn on parallel history
  shopt -s histappend
  history -a
  # Turn on checkwinsize
  shopt -s checkwinsize
  [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
  # You might want to have e.g. tty in prompt (e.g. more virtual machines)
  # and console windows
  # If you want to do so, just add e.g.
  # if [ "$PS1" ]; then
  #   PS1="[\u@\h:\l \W]\\$ "
  # fi
  # to your custom modification shell script in /etc/profile.d/ directory
fi

if ! shopt -q login_shell ; then # We're not a login shell
    # Need to redefine pathmunge, it get's undefined at the end of /etc/profile
    pathmunge () {
        case ":${PATH}:" in
            *:"$1":*)
                ;;
            *)
                if [ "$2" = "after" ] ; then
                    PATH=$PATH:$1
                else
                    PATH=$1:$PATH
                fi
        esac
    }

    # By default, we want umask to get set. This sets it for non-login shell.
    # Current threshold for system reserved uid/gids is 200
    # You could check uidgid reservation validity in
    # /usr/share/doc/setup-*/uidgid file
    if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
       umask 002
    else
       umask 022
    fi

    SHELL=/bin/bash
    # Only display echos from profile.d scripts if we are no login shell
    # and interactive - otherwise just process them to set envvars
    for i in /etc/profile.d/*.sh; do
        if [ -r "$i" ]; then
            if [ "$PS1" ]; then
                . "$i"
            else
                . "$i" >/dev/null
            fi
        fi
    done

    unset i
    unset -f pathmunge
fi
# vim:ts=4:sw=4

My /etc/profile:

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`id -u`
        UID=`id -ru`
    fi
    USER="`id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
fi

HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then 
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

unset i
unset -f pathmunge

I see something of TERM in /etc/bashrc but I don't know if it has influence.

@gsemet
Copy link
Member

gsemet commented Jun 15, 2015

Ok, reproduced by using /bin/sh shell. I'll check this asap. Also found an issue when changing shell...

@gsemet gsemet modified the milestones: 0.8.1, 0.7.0 Aug 18, 2015
@gsemet gsemet self-assigned this Aug 18, 2015
@gsemet gsemet modified the milestones: 0.8.1, 0.8.2 Sep 21, 2015
@gsemet gsemet removed this from the 0.8.2 milestone Oct 25, 2015
@gsemet gsemet removed this from the 0.8.2 milestone Oct 25, 2015
@thardev
Copy link
Contributor

thardev commented Nov 3, 2015

Hi all! 😃
After some research I found that this is an obsolete dependency issue. In this case VTE library again 😢.
Like you can see in this bug report is similiar and is up-to-date, so they reference this bug report, that one is older and it affects to gnome-terminal, but it's fixed. There's a discussion too in this post and they say that maybe is not the best idea to mess with TERM env.

@gsemet gsemet modified the milestones: 0.8.4, 0.8.5 Feb 29, 2016
@ghost
Copy link

ghost commented Mar 14, 2016

As I understand those bugreports, the a libvte-2.91 package (vte 0.38+) would fix this. Does any Ubuntu PPA exist, which ships Guake compiled against that version?

@gsemet gsemet modified the milestones: 0.8.5, 0.8.6 Jun 6, 2016
@gsemet gsemet modified the milestones: 0.8.6, 0.8.7 Aug 20, 2016
@gsemet gsemet modified the milestones: 0.8.8, 0.8.9 Dec 13, 2016
gsemet added a commit that referenced this issue Jan 30, 2017
gsemet added a commit that referenced this issue Jan 30, 2017
@gsemet gsemet modified the milestones: 0.8.9, 0.8.11 Jun 28, 2017
@gsemet gsemet removed this from the 0.8.11 milestone Jan 11, 2018
@Davidy22
Copy link
Collaborator

Davidy22 commented Sep 5, 2021

Closing as this has been fixed upstream for a few years now and can no longer replicate with /bin/sh

@Davidy22 Davidy22 closed this as completed Sep 5, 2021
@tp1050
Copy link

tp1050 commented Dec 29, 2022

I am having this issue myself, none of the Environmental variables I set in /etc/profile.d/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants