Bug 415249 - Tab goes unresponsive if copying in tmux copy mode
Summary: Tab goes unresponsive if copying in tmux copy mode
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: emulation (show other bugs)
Version: 19.12.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-16 15:45 UTC by kjift14
Modified: 2020-01-05 21:00 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.12.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kjift14 2019-12-16 15:45:54 UTC
I regularly use konsole (or rather, yakuake, but both share the exactly same behaviour), and tmux on an Archlinux desktop.

A recent package update to konsole-19.12.0-1 introduced a bug: I still can start tmux copy mode (C-b [), select text (space + navigation keys); but when I want to save this text in tmux's clipboard, the konsole tab freezes. It can be closed by the usual means (× symbol or C-R, the “really close?” dialog appears as it should), you can switch tabs/start new tabs, but the terminal itself is totally unresponsive. No CLI messages are created.

I can connect to the same tmux session from other terminals (I tried xterm) and there everything works as it did before. Even the copy did take place, you can paste the previously selected text (C-b ]).
Contrary, the bug occurs with tmux sessions from other hosts (SSH, tried with Gentoo, Debian Stretch, FreeBSD 12.1).

Oddly enough, this does only happen for copying plain terminal output, and not if the selected text is inside a Vim editor window.


Quick fix was downgrading & pinning konsole at version 19.08.3-1.
Downgrading tmux-2.9_a-4 (4 months old) did not help, so this new behaviour was introduced with the konsole update.




STEPS TO REPRODUCE
1. Open a konsole (or yakuake) window/tab
2. Open/connect to a tmux session (not necessarily local), regular terminal (not Vim)
3. Start copy mode (default key: C-b [)
4. Select some text
5. Save the text into clipboard (default: Enter)


OBSERVED RESULT
The tab in question becomes unresponsive and has to be closed forcibly.


EXPECTED RESULT
The tab to continue working (like it does in older Konsole versions and other terminal emulators).


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.4.3-arch1-1, no Plasma desktop (Fluxbox WM + Konsole as a standalone terminal emulator/Yakuake + Konsole KPart)
KDE Plasma Version: n/a
KDE Frameworks Version: n/a
Qt Version: 5.13.2-1 (Archlinux packages)

ADDITIONAL INFORMATION
Originally posted in the Archlinux tracker at https://bugs.archlinux.org/task/64848
Comment 1 adorkablue1996 2019-12-19 05:06:02 UTC
Confirmed.

SOFTWARE/OS VERSIONS (Archlinux packages)
Linux: 5.4.4-zen1-1-zen / Arch Linux
KDE Plasma Version: 5.17.4-2
KDE Frameworks Version: 5.64.0-1
Qt Version: 5.13.2-3
Comment 2 kde 2019-12-30 06:11:32 UTC
Confirmed.

KDE Plasma 5.17.4
KDE Frameworks 5.65.0
Qt 5.13.1
Kernel 5.3.12-1
Comment 3 dncrash 2020-01-02 09:25:16 UTC
Also happens here.

Linux: 5.4.2-arch1-1
Plasma: 5.17.4-2
Frameworks: 5.65.0-4
Qt5: 5.14.0-1
Comment 4 Kurt Hindenburg 2020-01-02 15:43:51 UTC
19.08 works but 19.12 does not - I'll do a git bisect later to find what commit caused it.
Comment 5 kjift14 2020-01-02 16:17:34 UTC
Also confirmed on Void Linux:

SOFTWARE/OS VERSIONS (Void Linux packages)
Linux: 5.3.18_1 / Void Linux
KDE Plasma Version: n/a
KDE Frameworks Version: 5.65.0_1
Qt Version: 5.13.2_2
konsole 19.12.0

It turns out that the hang is heavily dependent of how much text is selected/copied. Single characters/words/lines are no problem, but as soon as you select more than 4…8 lines (depending on length), tmux@konsole hangs.
Comment 6 Kurt Hindenburg 2020-01-03 15:47:03 UTC
Yes, make sure you select a large # of lines - it appears to be from the fixing of https://bugs.kde.org/show_bug.cgi?id=231405
Comment 7 Egmont Koblinger 2020-01-03 19:19:59 UTC
I had to press Ctrl+space to start selecting, and end it with Alt+w. Anyway, let's cut tmux off the game.

script'ing it reveals that simply passing a longer string to OSC 52, no matter if the terminator is BEL ("\a") or ST ("\e\\") causes such a hang.

Small reproducer:

lorem=$(echo Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | base64)
echo -ne "\e]52;;$lorem\a"
Comment 8 kjift14 2020-01-04 00:56:59 UTC
Thanks Egmont, nice find! I can confirm this MWE, also on OpenSUSE Tumbleweed (TIL that tmux switches to Vi mode if the 'vi' regex matches on $EDITOR; C-Space Alt-W are Emacs keybindings).
Comment 9 Kurt Hindenburg 2020-01-04 14:43:20 UTC
19.12.1 is going to be tagged on Monday - is there an easy fix or should this be reverted?
Comment 10 Mariusz Glebocki 2020-01-04 17:25:31 UTC
Yes. https://invent.kde.org/kde/konsole/merge_requests/61
Comment 11 Mariusz Glebocki 2020-01-05 15:47:05 UTC
Git commit 90b4f33965b9be2188af2e7bc223b88744a5c992 by Mariusz Glebocki.
Committed on 04/01/2020 at 17:23.
Pushed by hindenburg into branch 'master'.

Fix token buffer indexing
Related: bug 415463

M  +2    -1    src/Vt102Emulation.cpp

https://invent.kde.org/kde/konsole/commit/90b4f33965b9be2188af2e7bc223b88744a5c992
Comment 12 Mariusz Glebocki 2020-01-05 15:47:08 UTC
Git commit 90b4f33965b9be2188af2e7bc223b88744a5c992 by Mariusz Glebocki.
Committed on 04/01/2020 at 17:23.
Pushed by scmsync into branch 'master'.

Fix token buffer indexing
Related: bug 415463

M  +2    -1    src/Vt102Emulation.cpp

https://commits.kde.org/konsole/90b4f33965b9be2188af2e7bc223b88744a5c992
Comment 13 Kurt Hindenburg 2020-01-05 15:51:01 UTC
Git commit 23ddfcc4fcd3cce1b52a68f44b8a44f121d11919 by Kurt Hindenburg, on behalf of Mariusz Glebocki.
Committed on 05/01/2020 at 15:50.
Pushed by hindenburg into branch 'release/19.12'.

Fix token buffer indexing
Related: bug 415463

FIXED-IN: 19.12.1
(cherry picked from commit 90b4f33965b9be2188af2e7bc223b88744a5c992)

M  +2    -1    src/Vt102Emulation.cpp

https://invent.kde.org/kde/konsole/commit/23ddfcc4fcd3cce1b52a68f44b8a44f121d11919
Comment 14 Kurt Hindenburg 2020-01-05 15:51:05 UTC
Git commit 23ddfcc4fcd3cce1b52a68f44b8a44f121d11919 by Kurt Hindenburg, on behalf of Mariusz Glebocki.
Committed on 05/01/2020 at 15:50.
Pushed by scmsync into branch 'release/19.12'.

Fix token buffer indexing
Related: bug 415463

FIXED-IN: 19.12.1
(cherry picked from commit 90b4f33965b9be2188af2e7bc223b88744a5c992)

M  +2    -1    src/Vt102Emulation.cpp

https://commits.kde.org/konsole/23ddfcc4fcd3cce1b52a68f44b8a44f121d11919
Comment 15 kjift14 2020-01-05 21:00:41 UTC
I can confirm that the bug has gone!

konsole-git-r7039.7cfe2c8a-1 (Archlinux AUR)
konsole 20.03.70

Thank you all!