[Bug 10976] New: vi may lose ESCape key input

bugzilla at busybox.net bugzilla at busybox.net
Fri Apr 27 12:24:13 UTC 2018


            Bug ID: 10976
           Summary: vi may lose ESCape key input
           Product: Busybox
           Version: 1.28.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: mabnhdev at gmail.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

Created attachment 7581
  --> https://bugs.busybox.net/attachment.cgi?id=7581&action=edit
Input used to reproduce the bug.

vi is using read_key() to obtain input.  The read_key() __may__ process ESCape
sequences and __may__ silently drop invalid ESCape sequences.  This can result
in vi not seeing a valid ESCape keystroke such as to exit 'insert' mode.

The read_key() function opportunistically buffers and processes input.  If an
ESCape key is seen, read_key() will try to read the sequence completion in
order to process the sequence.  If the key following the ESCape is not a valid
ESCape sequence completion, the ESCape and any buffered data that follows is
silently dropped.

This issue typically will not show up during manual editing through vi as there
is very little chance that someone can type fast enough to get input buffered. 
However, if input is streamed, this problem is very common.

To reproduce:

Use a default busybox config to build.

Using the attached file, execute the following.

rm -f foo && busybox vi < test_vi_input

The command will terminate with the error 'vi: can't read user input'.  It
should terminate with no error and successfully create the file 'foo'.

You are receiving this mail because:
You are on the CC list for the bug.

More information about the busybox-cvs mailing list