Bug 1382219

Summary: nmtui exit by combination key (ESC + one of the Arrow Keys)
Product: Red Hat Enterprise Linux 7 Reporter: fine.fan <fine.fan>
Component: newtAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED NOTABUG QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: high Docs Contact:
Priority: high    
Version: 7.2CC: atragler, bgalvani, lrintel, mlichvar, rkhan, thaller
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-07 08:11: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:

Description fine.fan 2016-10-06 02:16:53 UTC
Description of problem:
The nmuti TUI could be killed by using combinationkey. (ESC+one of the Arrow)

Version-Release number of selected component (if applicable):
rhel-server-7.2-x86_64-dvd.iso

cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.2 (Maipo)


How reproducible:


Steps to Reproduce:
1.Install the OS with the iso 
2.use nmtui tool to config the NIC
3.at any screen of this scrreen
4.Press the ESC and then any of the Arrow keys

Actual results:
Get me out of the nmtui 

Expected results:
I may should still stay in the nmtui tool

Additional info:

Comment 1 fine.fan 2016-10-06 02:19:22 UTC
Steps to Reproduce:
1.Install the OS with the iso 
2.use nmtui tool to config the NIC
3.at any step of these screen
4.Press the ESC and then any of the Arrow keys

Comment 3 Beniamino Galvani 2016-10-06 07:50:00 UTC
nmtui registers a hotkey for ESCAPE in this way:

  newtFormAddHotKey (priv->form, NEWT_KEY_ESCAPE);

but it seems that the newt library generates the same code for all
unknown combinations as:

 ESC + letter
 ESC + arrow
 CTRL + arrow
 ...

For all these, newtExitStruct.u.key has the value 27 (ESC), so there
is no way nmtui can distinguish them from a real ESC press.

Reassigning to newt component for analysis.

Comment 4 Miroslav Lichvar 2016-10-07 08:11:26 UTC
Terminals don't support escape as a key modifier and there is no special sequence for such combinations. From the application point of view, escape + arrow key is the same as pressing escape and then arrow key. For example in xterm escape+left emits ^[^[OD, which is the same as pressing them sequentially.

To me it looks it's working as expected.

Comment 5 Beniamino Galvani 2016-10-07 13:04:22 UTC
(In reply to Miroslav Lichvar from comment #4)
> Terminals don't support escape as a key modifier and there is no special
> sequence for such combinations. From the application point of view, escape +
> arrow key is the same as pressing escape and then arrow key. For example in
> xterm escape+left emits ^[^[OD, which is the same as pressing them
> sequentially.

For the key combinations containing ESC, your explanation makes perfectly sense to me. However I noticed that all these other combinations are also handled as ESC and make nmtui quit; is this correct?

 ALT + letter
 CTRL + (arrow, ins, canc, pg-up, pg-down, ...)
 CTRL + function keys

For example, ALT+o emits ^[o which is \033o; that could be easily distinguished from ^[, no?

Comment 6 Miroslav Lichvar 2016-10-07 13:19:37 UTC
(In reply to Beniamino Galvani from comment #5)
> For example, ALT+o emits ^[o which is \033o; that could be easily
> distinguished from ^[, no?

Yes, if the newt's database contained such escape sequence. There are no NEWT_KEY_* constants defined in newt.h for these combinations, so the header would have to be expanded too.