Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1369182 - Arrow keys dont work inside tmux for putty in Fedora 24
Summary: Arrow keys dont work inside tmux for putty in Fedora 24
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: tmux
Version: 26
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Sven Lankes
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-22 15:28 UTC by Konstantin Zemlyak
Modified: 2017-07-27 16:52 UTC (History)
9 users (show)

Fixed In Version: tmux-2.2-4.fc25 tmux-2.5-1.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-27 16:52:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
fix for the application keys in tmux (1.08 KB, patch)
2017-06-09 17:04 UTC, Jacob Keller
no flags Details | Diff
updated SRPM package for Fedora 25 (471.11 KB, application/x-rpm)
2017-06-09 17:25 UTC, Jacob Keller
no flags Details
Fedora 26 SRPM (479.14 KB, application/x-rpm)
2017-07-13 19:06 UTC, Jacob Keller
no flags Details
fixed Fedora 26 SRPM (479.14 KB, application/x-rpm)
2017-07-13 19:13 UTC, Jacob Keller
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github https://github.com/tmux tmux issues 967 0 None None None 2020-04-29 16:09:35 UTC

Description Konstantin Zemlyak 2016-08-22 15:28:20 UTC
Description of problem:
When running tmux with TERM=putty[-256color] left/right arrows do not work inside.

Version-Release number of selected component (if applicable):
tmux-2.2-1.fc24.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Installed Fedora-Server 24 as a guest.
2. Connected from Windows with Putty 0.67 via ssh.
3. dnf install tmux
4. tmux
5. While typing commands cursor arrow keys up/down work, left/right don't.

Actual results:

$ echo $TERM
putty-256color
$ cat -vT
<pressing up, down, right, left, ^C here>
^[[A^[[B^[[C^[[D^C
$ tmux
$ echo $TERM
screen
$ cat -vT
<pressing up, down, right, left, ^C here>
^[[A^[[B^C
$ exit
$ TERM=xterm-256color tmux
$ echo $TERM
screen
$ cat -vT
<pressing up, down, right, left, ^C here>
^[[A^[[B^[[C^[[D^C
$

Expected results:
Should have seen ^[[A^[[B^[[C^[[D^C output for each cat -vT.

Additional info:
While using xterm-256color helps with tmux somewhat it breaks other funcionality, so can't be considered a fix.

Comparing 'infocmp -1 putty' output between fedora 23 and 24 reveals:

--- 23putty     2016-08-22 13:27:55.285713815 +0000
+++ 24putty     2016-08-22 13:26:31.376164245 +0000
@@ -55,13 +55,15 @@
        indn=\E[%p1%dS,
        initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x,
        is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R,
+       kLFT=\E[D,
+       kRIT=\E[C,
        kb2=\E[G,
        kbs=\177,
        kcbt=\E[Z,
-       kcub1=\E[D,
-       kcud1=\E[B,
-       kcuf1=\E[C,
-       kcuu1=\E[A,
+       kcub1=\EOD,
+       kcud1=\EOB,
+       kcuf1=\EOC,
+       kcuu1=\EOA,
        kdch1=\E[3~,
        kend=\E[4~,
        kf1=\E[11~,
@@ -86,9 +88,11 @@
        kf9=\E[20~,
        khome=\E[1~,
        kich1=\E[2~,
+       kind=\E[B,
        kmous=\E[M,
        knp=\E[6~,
        kpp=\E[5~,
+       kri=\E[A,
        kspd=^Z,
        nel=^M^J,
        oc=\E]R,
@@ -101,6 +105,7 @@
        rmam=\E[?7l,
        rmcup=\E[2J\E[?47l,
        rmir=\E[4l,
+       rmkx=\E[?1l\E>,
        rmpch=\E[10m,
        rmso=\E[27m,
        rmul=\E[24m,
@@ -117,6 +122,7 @@
        smam=\E[?7h,
        smcup=\E[?47h,
        smir=\E[4h,
+       smkx=\E[?1h\E=,
        smpch=\E[11m,
        smso=\E[7m,
        smul=\E[4m,

Seems like there has been some wrong changes to terminfo db in ncurses package.

Comment 1 Miroslav Lichvar 2016-08-23 07:29:01 UTC
Here is upstream discussion that led to this change in the putty terminfo:

https://lists.gnu.org/archive/html/bug-ncurses/2016-01/msg00010.html

Does the problem happen when not in tmux?

Comment 2 Konstantin Zemlyak 2016-08-24 04:20:20 UTC
Interesting. Testing with TERM=putty shows following:

1) 'cat -vT' shows that terminal sends \E[A .. \E[D by default, \E0A .. \E0D when holding shift and/or ctrl.
2) Outside of tmux arrows work fine in vim, nano, mc, bash, zsh, psql.
3) Inside tmux they still work fine in vim, nano, mc, but left/right does not work in bash, zsh and psql.
4) Holding shift and/or control inside tmux makes left/right arrows work.

Using TERM=putty-noapp fixes readline programs inside tmux.

I don't understand why up/down works but left/right doesn't. And can't decide what to blame - updated terminfo in ncurses, GNU readline not using application mode properly or tmux which exhibits weird behavior.

Also zsh deserves seperate bug for broken home/end keys.

Comment 3 Konstantin Zemlyak 2016-08-24 05:10:14 UTC
Upon reading http://git.suckless.org/st/plain/FAQ I've created ~/.inputrc with 'set enable-keypad on' line, and ~/.zshrc with:

    function zle-line-init () { echoti smkx }
    function zle-line-finish () { echoti rmkx }
    zle -N zle-line-init
    zle -N zle-line-finish

This have fixed the original issue, though home/end are still broken in zsh.

Comment 4 Diftraku 2016-11-18 20:55:22 UTC
I personally ended up getting an older version of the terminfo files from Ubuntu 14.04 (ncurses-term 5.9+20140118) and plopped them in-place over the newer ones (Fedora 24, ncurses-term 6.0-6.20160709) and everything works as usual.

I personally feel workarounds are not acceptable solutions and the older version of the PuTTY terminfos shoud be used instead of the newer upstream one for the time being.

Comment 5 Jacob Keller 2017-06-09 15:40:08 UTC
I have this exact problem on Fedora 25 still, the only workarounds are an old terminfo file, or using keypad on, in inputrc. The keypad solution is non-workable as it means that every single server I SSH into must have this setup.

Comment 6 Jacob Keller 2017-06-09 16:48:55 UTC
This is an issue in tmux, and was fixed in tmux 2.4

Comment 7 Jacob Keller 2017-06-09 17:04:52 UTC
Created attachment 1286471 [details]
fix for the application keys in tmux

The attached patch is a cherry-pick onto the 2.2 tag of tmux, which we should be able to backport and include to fix this issue in the tmux-2.2 source for Fedora 25.

Comment 8 Jacob Keller 2017-06-09 17:25:43 UTC
Created attachment 1286472 [details]
updated SRPM package for Fedora 25

I took the liberty of downloading the fedora 25 SRPM for tmux (tmux-2.2-3.fc25.src.rpm) and adding in the patch file that fixes the issue. Hopefully this helps the package owner out.

Comment 10 Fedora Update System 2017-06-10 02:30:37 UTC
tmux-2.2-4.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-094433a33e

Comment 11 Fedora Update System 2017-06-12 06:31:51 UTC
tmux-2.2-4.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-094433a33e

Comment 12 Fedora Update System 2017-07-06 02:20:59 UTC
tmux-2.2-4.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Jacob Keller 2017-07-13 18:54:47 UTC
This wasn't fixed upstream until tmux 2.5 so the same fix needs to be backported into the 2.3 package in Fedora 26.

Comment 14 Filipe Rosset 2017-07-13 18:59:59 UTC
I'm planning to update tmux on F26 to latest 2.5 release (already on rawhide).

Since F26 will be supported for at least 13 months I think it's the better approach.

Comment 15 Jacob Keller 2017-07-13 19:06:14 UTC
Created attachment 1297814 [details]
Fedora 26 SRPM

This uses the exact same patch for the Fedora 25 2.2 build.

Comment 16 Jacob Keller 2017-07-13 19:07:22 UTC
That's fine. I rebuilt a 2.3-3 version you can provide now or wait for the 2.5 update. I can easily use this 2.3-3 version locally until an update is provided.

Comment 17 Jacob Keller 2017-07-13 19:13:53 UTC
Created attachment 1297815 [details]
fixed Fedora 26 SRPM

The first attachment forgot to actually apply the patch.

Comment 18 Fedora Update System 2017-07-16 16:03:14 UTC
tmux-2.5-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-e9083815d8

Comment 19 Filipe Rosset 2017-07-16 16:05:00 UTC
tmux 2.5 available on Fedora 26, testing needed.

Comment 20 Fedora Update System 2017-07-17 03:25:34 UTC
tmux-2.5-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-e9083815d8

Comment 21 Jacob Keller 2017-07-17 23:20:42 UTC
This works for me in Fedora 26

Comment 22 Fedora Update System 2017-07-27 16:52:34 UTC
tmux-2.5-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.