default vi on focal emits escape sequences unrecognized by bionic's terminal?

Bug #1873920 reported by Dan Kegel
52
This bug affects 10 people
Affects Status Importance Assigned to Milestone
vim (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

On ubuntu 18.04, opening the default terminal (gnome-terminal 3.28.2-1ubuntu1~18.04.1), ssh'ing to an up-to-date ubuntu 20.04 system, running 'vi', and pressing 'i' shows the unwelcome garbage ESC [>4;m. Pressing ESC emits more garbage: ESC [>4;2m

Focal's default vi is provided by vim.tiny via alternatives. Oddly, when running vim.tiny by itself, or if you install vim and let it provide vi, the garbage does not appear.

Evidently focal's vim.tiny is confused about what escape sequences ubu1804's Terminal accepts.

TERM is xterm-256color. The problem also occurs if TERM is xterm.

There is no .vimrc.

If I use xterm on ubuntu 18.04, all is well. Evidently xterm accepts ESC[>4;m and gnome-terminal doesn't?

I captured a session using 'script' and dumped typescript via hexdump -C.
In this session, I typed i, Q, and escape. Here's an excerpt
showing the end of vi's welcome message, followed by five escape sequences
and then the Q I typed. The unrecognized ESC > 4;m is visible in the dump,
followed by ESC[?25l (CURSOR OFF)

00001070 66 61 75 6c 74 1b 5b 33 34 6d 3c 45 6e 74 65 72 |fault.[34m<Enter|
00001080 3e 1b 5b 6d 20 66 6f 72 20 69 6e 66 6f 20 6f 6e |>.[m for info on|
00001090 20 74 68 69 73 1b 5b 31 3b 31 48 1b 5b 3f 32 35 | this.[1;1H.[?25|
000010a0 68 1b 5b 3f 32 30 30 34 6c 1b 5b 3e 34 3b 6d 1b |h.[?2004l.[>4;m.|
000010b0 5b 3f 32 35 6c 51 1b 5b 38 3b 34 37 48 1b 5b 31 |[?25lQ.[8;47H.[1|

The mystery sequence ESC [ > 4;m appears to be "Set/reset key modifier options, xterm",
per https://invisible-island.net/xterm/ctlseqs/ctlseqs.html. So it's trying
to modify function keys, or something.

ssh'ing in from a mac worked fine (TERM there was also xterm-256color),
as did ssh'ing from an ubuntu 19.04 system with gnome-terminal.
ssh'ing from another ubuntu 18.04 system exhibited the same problem.

So it's a little family squabble between focal's vim.tiny and ubuntu 18.04/bionic's gnome-terminal...?

Given how long 18.04's going to be supported, this seems worth resolving somehow.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: vim-tiny 2:8.1.2269-1ubuntu5 [modified: usr/share/vim/vim81/doc/help.txt usr/share/vim/vim81/doc/tags]
ProcVersionSignature: Ubuntu 5.4.0-25.29-generic 5.4.30
Uname: Linux 5.4.0-25-generic x86_64
ApportVersion: 2.20.11-0ubuntu27
Architecture: amd64
CasperMD5CheckResult: skip
Date: Mon Apr 20 09:27:50 2020
InstallationDate: Installed on 2020-01-27 (83 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Alpha amd64 (20200124)
SourcePackage: vim
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Dan Kegel (dank) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in vim (Ubuntu):
status: New → Confirmed
Revision history for this message
Olivier Godart (olivier-godart-gmail) wrote :

Hi, does somebody have a workaround? Something to add/remove in the system vimrc config file?

Revision history for this message
Allen McIntosh (aamcintosh) wrote :

Workaround:

ex file

visual
("visual" can be abbreviated as "vi")

Revision history for this message
Allen McIntosh (aamcintosh) wrote :

Now that I think of it, that's qualitatively no different than running "vim.tiny"...

Revision history for this message
Ruben Garcia (rubengarciahernandez) wrote (last edit ):

The issue still exists as of Ubuntu 22.04.1 LTS and Ubuntu 18.04.6 LTS.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.