Bug 384620 - Broken ncurses box() rendering with new terminfo for TERM=xterm (no rep?)
Summary: Broken ncurses box() rendering with new terminfo for TERM=xterm (no rep?)
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Unclassified
Component: emulation (show other bugs)
Version: 17.08.1
Platform: Archlinux Packages Linux
: NOR major with 20 votes (vote)
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 391170 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-09-12 12:45 UTC by Krzysztof Kundzicz
Modified: 2018-04-11 01:34 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
konsole with TERM=xterm (up), TERM=linux (down) and a xterm window (right) (23.92 KB, image/png)
2017-09-12 12:45 UTC, Krzysztof Kundzicz
Details
terminfo entries (3.50 KB, application/x-compressed-tar)
2017-09-12 12:48 UTC, Krzysztof Kundzicz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Kundzicz 2017-09-12 12:45:36 UTC
Created attachment 107812 [details]
konsole with TERM=xterm (up), TERM=linux (down) and a xterm window (right)

After ArchLinux ncurses package update to version 20170902, drawing boxes in konsole using ncurses' 'box()' function is broken for TERM env variable set to xterm and its variants.

As far as I've found, it seems to be related to a change in terminfo.src:
# 2017-07-29
#       + add "rep" to xterm-new, available since 1997/01/26 -TD
< http://invisible-island.net/ncurses/terminfo.src.html#t20170729 >

Konsole seems to be lacking `rep` command support.

Steps to reproduce:
 0. Ensure you have the latest versions of ncurses and terminfo database.
 1. Copy and paste example ncurses program's source from http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/windows.html#LETBEWINDOW into a file
 2. Compile it, eg.:  gcc -lncurses -o boxtest boxtest.c
 3. Run it, eg. ./boxtest
 4. Rendered box (10 columns wide) is broken: its first and last row has only 3 columns; see attached screenshot

In konsole-17.08.1 box is rendered broken.
xterm-330 displays the box properly; TERM variable set to 'xterm', 'xterm-256color', 'linux', no difference, rendering always works.
rxvt-unicode-9.22 with TERM=xterm renders the box *broken*.

After changing the `TERM` env variable to, for e.g. 'linux' or 'rxvt', konsole starts to render the box properly.
My locale: LANG=pl_PL.UTF-8

With my distro's previous version of the terminfo (2017-05-13), konsole rendered box()-es ok.

Attached a screenshot: konsole with TERM=xterm (up), TERM=linux(down) and a xterm
Comment 1 Krzysztof Kundzicz 2017-09-12 12:48:21 UTC
Created attachment 107813 [details]
terminfo entries

Terminfo entries from the working and broken versions: compiled files and infocmp dumps
Comment 2 Wolfgang Bauer 2017-09-12 14:17:37 UTC
Might be fixed with newer ncurses though. There have been changes since 2017-07-29 ... ;-)
E.g. ncurses patch 20170827:
  + fix a bug in repeat_char logic (cf: 20170729, report by Chris Clayton).


See also http://bugzilla.opensuse.org/show_bug.cgi?id=1054448, which sounds similar to your problem.
Comment 3 Wolfgang Bauer 2017-09-12 14:24:20 UTC
PS, noticed now that you acually have version 20170902, but the confirmed "fixed" one mentioned in the openSUSE bug report is 20170909...
Comment 4 Krzysztof Kundzicz 2017-09-12 15:00:33 UTC
Nope, still broken.
Downloaded the new version (20170909), compiled it locally, replaced the whole terminfo database, and no change. The example program is still rendered wrong, as with the 20170902 version.

There is no changes between versions in the xterm-256color terminfo file:

athantor@athantor /tmp/ncurses-6.0-20170909 $ md5sum /tmp/nc20170909/usr/share/terminfo/x/xterm-256color /usr/share/terminfo/x/xterm-256color
a8db78a6f0ea1b480f6bd2198ed8f315  /tmp/nc20170909/usr/share/terminfo/x/xterm-256color
a8db78a6f0ea1b480f6bd2198ed8f315  /usr/share/terminfo/x/xterm-256color
athantor@athantor /tmp/ncurses-6.0-20170909 $ l /tmp/nc20170909/usr/share/terminfo/x/xterm-256color /usr/share/terminfo/x/xterm-256color
-rw-r--r-- 1 athantor athantor 3587 09-12 16:56 /tmp/nc20170909/usr/share/terminfo/x/xterm-256color
-rw-r--r-- 1 root     root     3587 09-04 08:13 /usr/share/terminfo/x/xterm-256color
athantor@athantor /tmp/ncurses-6.0-20170909 $
Comment 5 Wolfgang Bauer 2017-09-12 18:19:04 UTC
Indeed.
I upgraded to ncurses 20170909 here (I was using an older version), tried that boxtest example and can reproduce the problem (there are also glitches in htop or alsamixer e.g.).

Another workaround is to set TERM=xterm-color btw.

Interestingly, it's also (still) broken in gnome-terminal here, although at least one person explicitly wrote in that openSUSE bug report that it works there now. Maybe my version is too old, or he only tested a different issue... (there were several since the upgrade to ncurses 20170729 AFAIK)
Comment 6 Egmont Koblinger 2017-09-14 22:31:54 UTC
I've filed the same bug for gnome-terminal at https://bugzilla.gnome.org/show_bug.cgi?id=787701.
Comment 7 Werner Fink 2018-01-15 14:47:10 UTC
Are there any plans to add the rep feature for a better XTerm emulation of the konsole terminal emluator?
Comment 8 Wolfgang Bauer 2018-01-24 12:47:38 UTC
See https://phabricator.kde.org/D10064
Comment 9 Kurt Hindenburg 2018-01-26 14:36:40 UTC
The boxtest looks correct on Konsole master using TERM=xterm-256color and TERM=xterm

I'm currently testing on neon.kde.org distro

Do you have another test that shows the issue?
Comment 10 Wolfgang Bauer 2018-01-26 20:58:30 UTC
(In reply to Kurt Hindenburg from comment #9)
> I'm currently testing on neon.kde.org distro
> 
> Do you have another test that shows the issue?

You need to use a recent ncurses.
Versions before 20170729 didn't use REP yet.

KDE Neon is based on Ubuntu (16.04?) LTS, so likely has a "too old" ncurses.

I tried with the latest one from openSUSE Tumbleweed, the boxtest is broken with both TERM=xterm-256color and TERM=xterm, and https://phabricator.kde.org/D10064 fixes it.
Comment 11 Kurt Hindenburg 2018-01-27 04:19:56 UTC
confirmed on openSUSE Tumbleweed
Comment 12 Kurt Hindenburg 2018-02-04 20:31:30 UTC
forgot to add to commit message
Comment 13 Christoph Feck 2018-03-15 03:47:56 UTC
*** Bug 391170 has been marked as a duplicate of this bug. ***
Comment 14 John Little 2018-04-11 01:34:38 UTC
For those affected till the fix arrives, a work-around is 

    infocmp | sed 's/rep=[^,]*,//' | tic -