Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1367337

Summary: [RFE] Web console terminal should set TERM
Product: OpenShift Container Platform Reporter: Xingxing Xia <xxia>
Component: Management ConsoleAssignee: Jessica Forrester <jforrest>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.3.0CC: aos-bugs, jokerman, mmccomas, tdawson, wmeng
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Web console does not set a TERM environment variable when the Terminal execs into a pod using the /bin/sh command. Consequence: Certain commands like clear, less, and top do not behave as expected. Fix: The environment variable TERM=xterm is set when /bin/sh is used to connect to the pod. Result: Commands like clear, less, and top behave properly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-27 09:44:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xingxing Xia 2016-08-16 08:49:52 UTC
Description of problem:
Though https://bugzilla.redhat.com/show_bug.cgi?id=1317778 is fixed, web console still does not set TERM, causing less, top not work well.


Version-Release number of selected component (if applicable):
openshift v3.3.0.19

How reproducible:
Always

Steps to Reproduce:
1. On web console, click Applications --> Pods --> frontend-2-wu20y --> Terminal
2. After entering web terminal's shell, run:
sh-4.2$ top
TERM environment variable not set
sh-4.2$ less /etc/hosts
WARNING: terminal is not full functional
/etc/hosts (press RETURN)

If we press Enter, `less` can show the content of /etc/hosts, though

3. Set TERM manually, run top and less again
sh-4.2$ export TERM=xterm
sh-4.2$ top
sh-4.2$ less /etc/hosts

Actual results:
2. As stated in step inline.
3. top and less work well

Expected results:
2. It is better to automatically set TERM in web terminal like under CLI terminal. CLI terminal results are:
[tester@pc_vm3 oc]$ oc rsh frontend-2-wu20y
sh-4.2$ less /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
<snipped>

sh-4.2$ top

top - 08:37:49 up 1 day,  5:45,  0 users,  load average: 0.18, 0.24, 0.37
Tasks:   7 total,   1 running,   6 sleeping,   0 stopped,   0 zombie
<snipped>


Additional info:

Comment 1 Jessica Forrester 2016-08-16 13:54:42 UTC
The CLI attempts to use whatever your TERM env is set to and then falls back to xterm, see https://github.com/kubernetes/kubernetes/pull/28289/files

We don't know what your TERM env is, so the best we could do is always assume xterm.

Comment 2 Jessica Forrester 2016-08-16 22:36:55 UTC
merging to origin in https://github.com/openshift/origin/pull/10470

Comment 3 Troy Dawson 2016-08-18 19:35:33 UTC
This has been merged into ose and is in OSE v3.3.0.22 or newer.

Comment 5 Xingxing Xia 2016-08-19 06:57:33 UTC
Tested against openshift v3.3.0.22, now in web console terminal, TERM is automatically set to "xterm", `top` and `less` work well like under CLI

Comment 7 errata-xmlrpc 2016-09-27 09:44:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1933