Bug 389746 - Output is garbled when many lines are printed at once
Summary: Output is garbled when many lines are printed at once
Status: RESOLVED DUPLICATE of bug 379318
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 16.12.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-01 10:34 UTC by kdebugs
Modified: 2018-03-05 16:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screenshot of the garbled output (178.24 KB, image/png)
2018-02-01 10:34 UTC, kdebugs
Details
typescript with bug triggered (3.58 KB, text/plain)
2018-03-05 10:22 UTC, kdebugs
Details
screenshot corresponding to above typescript (33.57 KB, image/png)
2018-03-05 10:23 UTC, kdebugs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kdebugs 2018-02-01 10:34:06 UTC
Created attachment 110277 [details]
screenshot of the garbled output

Running this command seems to print Bs on top of existing text instead of scrolling down (see attached screenshot):

$ echo AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; sleep 1; echo -e 'B\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\n'

Switching between tmux windows or resizing the terminal (and probably anything else that forces a redraw) makes the text appear as it should.
I couldn't reproduce it in xterm or even Konsole, which makes me think this is specific to Yakuake.

My speculation is that this happens when a command prints out more lines at once than terminal height.
Comment 1 kdebugs 2018-02-22 12:07:23 UTC
After some more testing I got this to reproduce in Konsole.
Comment 2 kdebugs 2018-02-22 12:17:34 UTC
Another data point: seems to reproduce only inside of tmux (2.6). But does not reproduce with tmux and xterm!
Comment 3 Kurt Hindenburg 2018-02-24 01:31:32 UTC
What distro are you using? Are you running that in yakuake?

 W/ tmux 2.1, it works as expected.
Comment 4 kdebugs 2018-03-01 16:48:59 UTC
Company-internal distro based on Debian. I've encountered it in Yakuake, but then also managed to reproduce it in Konsole.
Comment 5 Egmont Koblinger 2018-03-01 21:15:17 UTC
Took me a while to realize, so let's emphasize: In the screenshot, the first column is full of B's.
Comment 6 Egmont Koblinger 2018-03-01 21:29:59 UTC
How reproducible is this?

What's the value of $TERM outside of tmux?

I believe the first big step in debugging would be to locate whether this is a bug in konsole/yakuake or tmux. I can easily imagine both, and not being able to reproduce in xterm could be due to different timing of things if it's a tmux issue.

Here's how I'd proceed:

- Take a note of the window size (e.g. "stty size").

- Start "script", and then start "tmux".

- Reproduce the bug in as few steps as possible.

- Quit tmux, then quit script (e.g. press ^D twice).

- Attach the resulting "typescript" file, and also share the window size with us.

- We could then manually investigate whether what appears in konsole's window matches the contents of "typescript" or not. By cutting off the end of the "typescript" file (the bits corresponding to exiting, most notably tmux leaving alternate screen) we should be able to deterministically reproduce the faulty result using a simple "cat typescript" at the same terminal size, and even do this in other terminal emulators. If by cat'ing typescript the result is the same in all terminal emulators, namely the bad rendering, then it's tmux asking for stupid things from konsole. If cat'ing is only broken in konsole, or is still random (e.g. depends on timing) then it's a konsole issue.
Comment 7 kdebugs 2018-03-05 10:22:23 UTC
Created attachment 111196 [details]
typescript with bug triggered
Comment 8 kdebugs 2018-03-05 10:23:33 UTC
Created attachment 111197 [details]
screenshot corresponding to above typescript
Comment 9 kdebugs 2018-03-05 10:28:09 UTC
Thanks for the detailed instructions! I've attached the typescript to this bug.

Terminal size and TERM value:

% stty size
24 80
% printenv TERM
xterm-256color

I've tried cat'ing the copy of typescript with the ending removed and it still triggers the bug in Konsole, but xterm is fine.
Comment 10 Egmont Koblinger 2018-03-05 14:23:35 UTC
Indeed, I can reproduce it now in konsole-17.04.3, by cat'ing with the end of the file removed (truncate -s 3276 typescript), the result is significantly different from xterm or vte.
Comment 11 Egmont Koblinger 2018-03-05 14:43:36 UTC
Timing doesn't matter in konsole, slowcat'ing this file by inserting a 50ms pause between each byte (after compiling VTE: vte/src/slowcat -t 50000 typescript) produces the same output.

If timing makes a difference at all, as seen originally, it might be because tmux receives its stuff at different times and hence updates in different ways, all of which _should_ result in the same final look.

What triggers the problem in konsole is at byte offset 2810 of typescript.

To reproduce manually: Produce at least a screen of data, then execute:

echo -e "\e[1;23r\e[23S"

It sets up the scrolling region to rows 1-23 (that is, the bottom row, row 24 excluded) and asks to scroll by 23 lines. This should effectively clear those lines (and leave the bottom row intact), but it konsole it doesn't do anything.

I vaguely recall already having seen a bug report for this in konsole (it's buggy when the parameter to S [the number of lines to scroll by] is greater-than-or-equal-to the height of the scrolling area), but cannot find it now.
Comment 12 Egmont Koblinger 2018-03-05 14:49:13 UTC
Bug 379318 is the one I was looking for. I suspect this is a duplicate. If so, it's already fixed.
Comment 13 kdebugs 2018-03-05 16:08:55 UTC
Thanks! It seems that this is indeed a duplicate of bug 379318.

According to https://github.com/KDE/konsole/commit/7ff23512fd6c6af1dba87083446f85baf75e9c71 , earliest release that has the fix is 17.07.80.
Comment 14 kdebugs 2018-03-05 16:36:34 UTC

*** This bug has been marked as a duplicate of bug 379318 ***