Bug 1326467 - thermostat shell gets broken by TERM=dumb env. variable
Summary: thermostat shell gets broken by TERM=dumb env. variable
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Software Collections
Classification: Red Hat
Component: thermostat1
Version: thermostat1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Omair Majid
QA Contact: zzambers
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-12 18:16 UTC by zzambers
Modified: 2016-04-26 16:02 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-26 16:02:26 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description zzambers 2016-04-12 18:16:34 UTC
Description of problem:

When env. variable TERM=dumb thermostat shell gets broken. This only happens when stdin is read from pipe, redirected from file or using process substitution. Issuing commands manually seems to work normally.


Steps to Reproduce:
1. run thermostat setup
2. export TERM=dumb
3. echo 'help\nexit\n' | scl enable thermostat1 "thermostat shell"

Actual results:
shell gets broken (input including newlines is not visible) 

Expected results:
shell does not get broken


Additional info:
I have tried several values for TERM ( dumb, vt100, vt220, xterm-256color, random characters ) and only one dumb seems broken. Unseting TERM entirely also seems OK.

Comment 1 Omair Majid 2016-04-12 20:27:15 UTC
'dumb' is an actual valid terminal name: 

$ file /usr/share/terminfo/d/dumb 
/usr/share/terminfo/d/dumb: Compiled terminfo entry

Comment 2 zzambers 2016-04-13 12:27:18 UTC
3. step should have been 
echo -en 'help\nexit\n' | scl enable thermostat1 "thermostat shell"

even though it doesn't really matter (wrong input works as well)

Comment 3 Omair Majid 2016-04-22 23:09:23 UTC
Seems to be a bug in jline. I can reproduce with thermostat1-jline2-2.10-70.5.el7.noarch but not if I replace /opt/rh/thermostat1/root/usr/share/java/jline2/jline.jar with the jline-2.9.jar from an upstream build of thermostat-1.4.

Comment 4 Omair Majid 2016-04-22 23:19:07 UTC
This might be caused by this fix: https://github.com/jline/jline2/commit/6f69925f53c07b0b5a8ecf45c18371413703b947

This actually fixes jline to detect TERM=dumb correctly (which it then handles by not echoing input?)

Comment 5 Omair Majid 2016-04-25 17:53:36 UTC
Here's a few examples of how other readline-using programs behave. I didn't set TERM here (my default is screen-256color).

calc:

$ echo -e '(1 + 2)\nexit\n' | calc        
        3

gdb:

$ echo -e 'print $1\nquit\n' | gdb
GNU gdb (GDB) Fedora 7.10.1-31.fc23
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) History has not yet reached $1.
(gdb) 


guile:

$ echo -e '(write "Hi")\n(exit)\n' | guile
GNU Guile 2.0.11
Copyright (C) 1995-2014 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
"Hi"

sqlite3:

$ echo -e '.help\n.exit\n' | sqlite3
.backup ?DB? FILE      Backup DB (default "main") to FILE
.bail on|off           Stop after hitting an error.  Default OFF
.binary on|off         Turn binary output on or off.  Default OFF
.changes on|off        Show number of rows changed by SQL
<output deleted>
vfsname ?AUX?         Print the name of the VFS stack
.width NUM1 NUM2 ...   Set column widths for "column" mode
                         Negative values right-justify

None of them display the input when the input is piped.

Perhaps, from a sensible design point of view, we should do the same in Thermostat?

Comment 6 Omair Majid 2016-04-26 16:02:26 UTC
This bug happens in a very rare case (setting TERM to dumb), only affects the input being displayed - not the output - and occurs because of an upstream project (jline). Given the low impact and high amount of effort needed to fix this bug, I am closing this as WONTFIX in this release.


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