[vim/vim] :e `yes` hangs without being able to interrupt with CTRL-C (#6770)

17 views
Skip to first unread message

Dominique Pellé

unread,
Aug 22, 2020, 4:52:32 AM8/22/20
to vim/vim, Subscribed

The following Ex command causes vim to hang and it's not possible to recover with CTRL-C:

:e `yes`

Same issue with:

:echo expand("`yes`")

In contrast, it is possible to interrupt with CTRL-C when doing e.g.:

:!yes

or:

:echo system('yes')

Expected behavior
It should be possible to interrupt an endless command with CTRL-C.

Environment

  • Vim-8.2.1505 (huge, x86_64, Linux)
  • OS: xubuntu-18.04.5


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Aug 22, 2020, 10:06:11 AM8/22/20
to vim/vim, Subscribed


Dominique wrote:

> The following Ex command causes vim to hang and it's not possible to recover with `CTRL-C`:
> ```
> :e `yes`
> ```
> Same issue with:
> ```
> :echo expand("`yes`")
> ```
> In contrast, it is possible to interrupt with CTRL-C when doing e.g.:
> ```
> :!yes
> ```
> or:
> ```
> :echo system('yes')
> ```
> **Expected behavior**

> It should be possible to interrupt an endless command with CTRL-C.
>
> **Environment**
> - Vim-8.2.1505 (huge, x86_64, Linux)
> - OS: xubuntu-18.04.5

I tried a few things but I can't make the child process, in which the
shell runs "yes", to respond to CTRL-C. I tried forcing "cooked" mode.
Signals are already set back to default behavior. Not sure what else to
try.

--
hundred-and-one symptoms of being an internet addict:
265. Your reason for not staying in touch with family is that
they do not have e-mail addresses.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Dominique Pellé

unread,
Aug 23, 2020, 3:46:30 AM8/23/20
to vim/vim, Subscribed

The following Ex command causes vim to hang and it's not possible to recover with CTRL-C:
:e `yes`

/usr/bin/vim that comes with Ubuntu-18.04.05 i.e. vim-8.1.1453 does not have the bug.
So it's a regression. Doing a git bisection, I found that:

  • 8.2.0774 has the bug
  • 8.2.0773 does not have the bug

So bug was introduced in this patch: 26e8644 :

commit 26e86445bf06ab7e7587dfdf75f33f7c70632b46
Author: Bram Moolenaar <Br...@vim.org>
Date:   Sun May 17 14:06:16 2020 +0200

    patch 8.2.0774: t_TI and t_TE are output when using 'visualbell'
    
    Problem:    t_TI and t_TE are output when using 'visualbell'. (Dominique
                Pelle)
    Solution:   Do not change the terminal mode for a short sleep.  Do not output
                t_TI and t_TE when switching to/from TMODE_SLEEP. Make tmode an
                enum.

Bram Moolenaar

unread,
Aug 23, 2020, 8:08:26 AM8/23/20
to vim/vim, Subscribed


> > The following Ex command causes vim to hang and it's not possible to recover with CTRL-C:
> > :e \`yes\`
>
> `/usr/bin/vim` that comes with Ubuntu-18.04.05 i.e. vim-8.1.1453 does not have the bug.

> So it's a regression. Doing a git bisection, I found that:
> * 8.2.0774 has the bug
> * 8.2.0773 does not have the bug
>
> So bug was introduced in this patch: https://github.com/vim/vim/commit/26e86445bf06ab7e7587dfdf75f33f7c70632b46 :
> ```

> commit 26e86445bf06ab7e7587dfdf75f33f7c70632b46
> Author: Bram Moolenaar <Br...@vim.org>
> Date: Sun May 17 14:06:16 2020 +0200
>
> patch 8.2.0774: t_TI and t_TE are output when using 'visualbell'
>
> Problem: t_TI and t_TE are output when using 'visualbell'. (Dominique
> Pelle)
> Solution: Do not change the terminal mode for a short sleep. Do not output
> t_TI and t_TE when switching to/from TMODE_SLEEP. Make tmode an
> enum.
> ```

Reverting two parts of that indeed helps. I'll have to see how we can
fix it without rolling back that patch.

--
ARTHUR: This new learning amazes me, Sir Bedevere. Explain again how sheep's
bladders may be employed to prevent earthquakes.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD


/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Bram Moolenaar

unread,
Aug 23, 2020, 8:29:33 AM8/23/20
to vim/vim, Subscribed

Closed #6770 via 0981c87.

Bram Moolenaar

unread,
Aug 23, 2020, 9:10:18 AM8/23/20
to vim...@googlegroups.com, Bram Moolenaar

> > > The following Ex command causes vim to hang and it's not possible to recover with CTRL-C:
> > > :e \`yes\`
> >
> > `/usr/bin/vim` that comes with Ubuntu-18.04.05 i.e. vim-8.1.1453 does not have the bug.
> > So it's a regression. Doing a git bisection, I found that:
> > * 8.2.0774 has the bug
> > * 8.2.0773 does not have the bug
> >
> > So bug was introduced in this patch: https://github.com/vim/vim/commit/26e86445bf06ab7e7587dfdf75f33f7c70632b46 :
> > ```
> > commit 26e86445bf06ab7e7587dfdf75f33f7c70632b46
> > Author: Bram Moolenaar <Br...@vim.org>
> > Date: Sun May 17 14:06:16 2020 +0200
> >
> > patch 8.2.0774: t_TI and t_TE are output when using 'visualbell'
> >
> > Problem: t_TI and t_TE are output when using 'visualbell'. (Dominique
> > Pelle)
> > Solution: Do not change the terminal mode for a short sleep. Do not output
> > t_TI and t_TE when switching to/from TMODE_SLEEP. Make tmode an
> > enum.
> > ```
>
> Reverting two parts of that indeed helps. I'll have to see how we can
> fix it without rolling back that patch.

It looks like when modifyOtherKeys is enabled, the system does not
recognize CTRL-C as the interrupt character. I had the same problem
inside Vim as well. I'm not sure it works well to change the terminal
properties, thus disabling modifyOtherKeys while the shell is running
seems like the best solution. I wonder if there is maybe another place
where this should be done.

--
Women are probably the main cause of free software starvation.

Dominique Pellé

unread,
Aug 24, 2020, 9:12:18 AM8/24/20
to vim/vim, Subscribed

With the fix in vim-8.2.1513, I can now interrupt commands like...

:e `yes`

 :echo expand("`yes`")`

Good. However, I now see spurious characters. For example, if I run :!date, I get:

�[>4;mMon Aug 24 15:03:49 CEST 2020

�[>4;2m

Press ENTER or type command to continue

Whereas prior to vim-8.2.1513, I would get the expected:

Mon Aug 24 15:03:49 CEST 2020



Press ENTER or type command to continue

This is with xfce4-terminal-0.8.7.4 that comes with Ubuntu-18.04.5.
Same issue at least with gnome-terminal 3.28.2 that comes with Ubuntu-18.04.5.

Bram Moolenaar

unread,
Aug 24, 2020, 2:59:34 PM8/24/20
to vim/vim, Subscribed

That is a bug in the terminal, the t_TE and t_TI codes should be ignored if not recognized.
You might find a more recent terminal version that has fixed this.
Or you can make t_TE and t_TI empty.
It's not nice, but not being able to interrupt the shell is worse.
For me it continued until /tmp was full before it gave up producing "y".

Reply all
Reply to author
Forward
0 new messages