Bug 1317784

Summary: oc rsh does not set console geometry
Product: OpenShift Container Platform Reporter: Evgheni Dereveanchin <ederevea>
Component: NodeAssignee: Andy Goldstein <agoldste>
Status: CLOSED ERRATA QA Contact: DeShuai Ma <dma>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.1.0CC: agoldste, aos-bugs, dapark, erich, jokerman, mbarrett, mmccomas, wmeng
Target Milestone: ---Keywords: NeedsTestCase
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: atomic-openshift- Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-27 09:36:25 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:
Bug Depends On:    
Bug Blocks: 1356062, 1486196    

Description Evgheni Dereveanchin 2016-03-15 08:30:52 UTC
Description of problem:
 when running "oc rsh", geometry of the console is not passed to the container, so the shell works with default 80×25 geometry which causes scrollback issues in programs like "less"

Version-Release number of selected component (if applicable):
# oc version
oc v3.1.1.6-21-gcd70c35
kubernetes v1.1.0-origin-1107-g4c8e6f4

How reproducible:

Steps to Reproduce:
1. oc rsh <pod>
2. set TERM manually to enable scrollback (bz#1317778)
 export TERM=xterm
3. less /path/to/log

Actual results:
 file opens up, but when trying to scroll back the screen is corrupted as the actual terminal size is different from what the container thinks.

Expected results:
 scrollback works properly in less, other command-line tools also work correctly to make troubleshooting easier.

Additional info:

 Here's the geometry reported by "stty -a" in the container
  speed 38400 baud; rows 0; columns 0; line = 0;

 To work around this issue I did this:
  1) find out the geometry of the shell by running "stty -a" before "oc rsh"
  2) set the same geometry in the container 
    stty rows 62 columns 224
 this made less work properly, however it needs to be done each time and will not catch the changes in terminal window size.

Comment 2 Andy Goldstein 2016-07-13 19:48:23 UTC

Comment 3 Andy Goldstein 2016-07-15 14:49:34 UTC
The upstream PR merged. I've opened https://github.com/openshift/origin/pull/9878 to cherry-pick to Origin.

Comment 4 Andy Goldstein 2016-08-04 10:38:44 UTC
Fixed in

Comment 5 Weihua Meng 2016-08-05 06:45:30 UTC
openshift v3.3.0.14
kubernetes v1.3.0+57fb9ac
etcd 2.3.0+git

sh-4.2$ stty -a
speed 38400 baud; rows 42; columns 114; line = 0;

Comment 7 errata-xmlrpc 2016-09-27 09:36:25 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.