WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Inconsequent TERM variable setting  (Read 3086 times)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7035
    • My Community Forum
Inconsequent TERM variable setting
« on: September 12, 2010, 11:57:53 PM »
Environment variable TERM is set to 'rxvt' for programs in aterm, while it is set to 'linux' for programs started with exec on WBAR or in applications menu of TC. It means that programs get different TERM environment variable depending on running aterm or lxterminal (or other terminal emulators). It is the reason why for example midnight-commander behaves differently in certain cases. Changing TERM manually to 'rxvt' fix such problems.

Would appreciate TERM=rxvt in all cases provided by the base.
« Last Edit: September 13, 2010, 12:05:11 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Inconsequent TERM variable setting
« Reply #1 on: September 13, 2010, 01:06:56 AM »
if
Quote
TERM=rxvt in all cases provided by the base
would all applications still work to satisfaction on the console (VT)?
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7035
    • My Community Forum
Re: Inconsequent TERM variable setting
« Reply #2 on: September 13, 2010, 01:24:15 AM »
if
Quote
TERM=rxvt in all cases provided by the base
would all applications still work to satisfaction on the console (VT)?

For sure nobody can make a statement that all apllications will work... However 'rxvt' is the defaut setting for all console applications, so there are no change. urxvt is an rxvt emulator, so it is ok. Most of the other terminal emulators, like lxterminal, Terminal, etc. are only GUI's to the vte engine. vte is configured for also rxvt, see /usr/local/share/vte/termcap. If it is running with TERM=linux it is causing false operation of keyboard, etc.

Anyhow, current setting is inconsequent and the best way is to cure this. Then deal with remaining problems if there is any.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Inconsequent TERM variable setting
« Reply #3 on: September 13, 2010, 02:29:15 AM »
Thanks for the explanation!  :)
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10226
Re: Inconsequent TERM variable setting
« Reply #4 on: September 13, 2010, 05:32:32 AM »
Maybe in .xsession, so that the linux console stays as is.
The only barriers that can stop you are the ones you create yourself.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Inconsequent TERM variable setting
« Reply #5 on: September 13, 2010, 08:41:17 AM »
midnight commander definitely does not display correctly in console with TERM=rxvt.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7035
    • My Community Forum
Re: Inconsequent TERM variable setting
« Reply #6 on: September 13, 2010, 08:45:39 AM »
midnight commander definitely does not display correctly in console with TERM=rxvt.


Details please. In which terminal emulator, LANG setting, fonts, TC or MC, which version? Screenshot would be appreciated.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9688
Re: Inconsequent TERM variable setting
« Reply #7 on: September 13, 2010, 09:02:24 AM »
TERM=linux  while in the console is pretty standard and well documented.  I don't think there will be much consensus to change that variable for the console. 

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7035
    • My Community Forum
Re: Inconsequent TERM variable setting
« Reply #8 on: September 13, 2010, 09:14:47 AM »
TERM=linux  while in the console is pretty standard and well documented.  I don't think there will be much consensus to change that variable for the console.  

I never told TERM=linux is wrong. What I told system is inconsequent. Lets use rxvt or linux, both are good. Anyhow, you can mix up as you wish. xterm would be alse as good as other two, like in REDHAT/CentOS. There is always a solution. A bit more code, a bit more wasted time to fix. :(
« Last Edit: September 13, 2010, 09:16:52 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9688
Re: Inconsequent TERM variable setting
« Reply #9 on: September 13, 2010, 10:44:49 AM »
I notice Debian uses linux for the console, the TERM variable is rxvt when running rxvt, xterm when running xterm, and so on.

But I didn't notice what it is set to in Debian when launching a program in X from a menu.  Of course, Debian is just being used as an example and not a must-have rule.

I am curious, and will look and see when I get in tonight.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7035
    • My Community Forum
Re: Inconsequent TERM variable setting
« Reply #10 on: September 13, 2010, 11:17:39 AM »
I checked LUBUNTU and CentOS and found rxvt and xterm in all tested cases. Theoretically you can build up a system which works with the different terminal settings using termcap/termlib if the applications can handle and are compiled properly, but the practice is different. If you are using aterm TERM=rxvt which is good for all console tools I tested. Also, using urxvt in an UTF-8 environment works fine. When tested lxterminal with new mc built in hu_HU.UTF-8 there was a mess on the screen, so started to investigate cause as I thought it is up to UTF-8 but learned it is the terminal setting. Starting lxterminal from aterm its getting TERM=rxvt so works as expected. I wrote a small C test program which saves TERM value in a file and started with exec on the same way as TC starts applications and there I see TERM=linux.

Providing TERM=rxvt for programs would be the easiest fix at least in cases I tested and with the current application base. However lxterminal is just optional as other vte based terminal emulators. Their main advantage is UTF-8 support.

urxvt as a generic UTF-8 terminal emulator works fine however with TC 3.1 as it is so vte terminals not a must have apps. :)
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9688
Re: Inconsequent TERM variable setting
« Reply #11 on: September 13, 2010, 05:02:54 PM »
I got home and checked this out on Debian and when you launch rox filer from an xterm window, then double click on a shell script that simply echoes the $TERM variable, it returns it as xterm.

But when you launch rox filer from a menu and then click on the script to run it, it says the TERM variable is linux.  So at least we are basically in keeping with what Debian does in that regard.

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: Inconsequent TERM variable setting
« Reply #12 on: September 13, 2010, 07:51:16 PM »
I haven't tested, but isn't midnight-commander a console application.. and it would be launched from inside an aterm (in X)?  And this causes a change in TERM somehow?
« Last Edit: September 13, 2010, 07:52:49 PM by ^thehatsrule^ »

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7035
    • My Community Forum
Re: Inconsequent TERM variable setting
« Reply #13 on: September 13, 2010, 11:17:18 PM »
Also a terminal emulator may change TERM. urxvt for example sets TERM=rxvt-unicode which is also a problem. The good point, that you can set it to any value using -tn switch or in a script copy original TERM. I will replace aterm with urxvt in LXDE and Xfce4 as a default terminal with proper config and problem solved in these DE's using stock TC 3.1

This is needed not because TERM but to support UTF-8 with less dependencies as lxterminal or Terminal has.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."