Bug 1367337 - [RFE] Web console terminal should set TERM
Summary: [RFE] Web console terminal should set TERM
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Jessica Forrester
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-16 08:49 UTC by Xingxing Xia
Modified: 2017-03-08 18:26 UTC (History)
5 users (show)

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.
Clone Of:
Environment:
Last Closed: 2016-09-27 09:44:26 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1933 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.3 Release Advisory 2016-09-27 13:24:36 UTC

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


Note You need to log in before you can comment on or make changes to this bug.