New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start tmux + resize window + exit tmux = bug #40

Closed
safinaskar opened this Issue Jul 5, 2015 · 21 comments

Comments

4 participants
@safinaskar

safinaskar commented Jul 5, 2015

How to reproduce:

  • Debian GNU/Linux, KDE
  • Maximize Konsole (sic!) terminal emulator
  • Press "Enter" many times to bash (so, Konsole window should be filled with bash prompts)
  • Type "tmux" to bash
  • Restore the window to normal size
  • Type "exit" to tmux

What I see:

  • I get corrupted Konsole window. I see:

root@comp:#
[exited]p:
#
root@comp:~# _

Tested with Debian Jessie, tmux 1.9, Konsole 2.14.2 (KDE 4). Also with current Debian Sid, tmux 2.0, Konsole 2.14.2 (KDE 4).

I think that this bug is unrelated with Konsole, KDE etc and should be reproducible with other emulators. Also, bug is not reproducible if I replace tmux (for example) with less

@ThomasAdam

This comment has been minimized.

Show comment
Hide comment
@ThomasAdam

ThomasAdam Jul 5, 2015

Contributor

Corrupt how? Can you be more specific? I can't seem to reproduce this in xterm.

Contributor

ThomasAdam commented Jul 5, 2015

Corrupt how? Can you be more specific? I can't seem to reproduce this in xterm.

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 5, 2015

I showed you how. "[exited]" appears directly on bash prompt and I get [exited]p:~# instead of root@comp:~#. I can reproduce this in xterm.

Well, again: open fresh terminal emulator, maximize it. Then press "Enter" a lot of times. So the whole window must be full of promts. Then type "tmux", restore window to smaller size, type "exit". And you will get [exited]p:~#.

Did you reproduce now? If no, I can send you video, or send exact algorithm to bootstrap whole OS, where you can reproduce the bug, or send you a virtual machine

safinaskar commented Jul 5, 2015

I showed you how. "[exited]" appears directly on bash prompt and I get [exited]p:~# instead of root@comp:~#. I can reproduce this in xterm.

Well, again: open fresh terminal emulator, maximize it. Then press "Enter" a lot of times. So the whole window must be full of promts. Then type "tmux", restore window to smaller size, type "exit". And you will get [exited]p:~#.

Did you reproduce now? If no, I can send you video, or send exact algorithm to bootstrap whole OS, where you can reproduce the bug, or send you a virtual machine

@ThomasAdam

This comment has been minimized.

Show comment
Hide comment
@ThomasAdam

ThomasAdam Jul 5, 2015

Contributor

No, thank you. Can you tell me what TERM is set to inside and outside of tmux, please? And can you also do this with:

pkill tmux ; tmux -vvvvv

and put the resultant tmux-server-*.log file somewhere for me to see?

Contributor

ThomasAdam commented Jul 5, 2015

No, thank you. Can you tell me what TERM is set to inside and outside of tmux, please? And can you also do this with:

pkill tmux ; tmux -vvvvv

and put the resultant tmux-server-*.log file somewhere for me to see?

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 5, 2015

Debian Jessie. Outside: TERM=xterm, inside: TERM=screen. pkill says "pkill: no matching criteria specified".

I reproduced the bug with tmux -vvvvv. base64'd log here: http://paste.debian.net/279428

safinaskar commented Jul 5, 2015

Debian Jessie. Outside: TERM=xterm, inside: TERM=screen. pkill says "pkill: no matching criteria specified".

I reproduced the bug with tmux -vvvvv. base64'd log here: http://paste.debian.net/279428

@ThomasAdam

This comment has been minimized.

Show comment
Hide comment
@ThomasAdam

ThomasAdam Jul 5, 2015

Contributor

Really? Just put the plain text version somewhere, please

Contributor

ThomasAdam commented Jul 5, 2015

Really? Just put the plain text version somewhere, please

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 5, 2015

Why this is so difficult to do base64 -d? Well, okey: http://paste.debian.net/279450 , but this log contained non-printing characters, such as ESC. Also, I don't think this log is very useful, because the most interesting things happen right after exiting from tmux

safinaskar commented Jul 5, 2015

Why this is so difficult to do base64 -d? Well, okey: http://paste.debian.net/279450 , but this log contained non-printing characters, such as ESC. Also, I don't think this log is very useful, because the most interesting things happen right after exiting from tmux

@ThomasAdam

This comment has been minimized.

Show comment
Hide comment
@ThomasAdam

ThomasAdam Jul 5, 2015

Contributor

Because I'm not near a machine where I can run that command, and you're being awkward by even trying to help.

I still can't reproduce this, sorry. The only thing I can think of is you might have something in your PS1 causing this.

Contributor

ThomasAdam commented Jul 5, 2015

Because I'm not near a machine where I can run that command, and you're being awkward by even trying to help.

I still can't reproduce this, sorry. The only thing I can think of is you might have something in your PS1 causing this.

@nicm

This comment has been minimized.

Show comment
Hide comment
@nicm

nicm Jul 6, 2015

Contributor

tmux version?

Contributor

nicm commented Jul 6, 2015

tmux version?

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 6, 2015

something in your PS1 causing this.

My second test OS (i. e. Debian Sid) has very standard PS1.

tmux version

Again, tmux 1.9 on Debian Jessie and tmux 2.0 on Debian Sid

safinaskar commented Jul 6, 2015

something in your PS1 causing this.

My second test OS (i. e. Debian Sid) has very standard PS1.

tmux version

Again, tmux 1.9 on Debian Jessie and tmux 2.0 on Debian Sid

@nicm

This comment has been minimized.

Show comment
Hide comment
@nicm

nicm Jul 6, 2015

Contributor

Run tmux in script(1) and reproduce and show me the typescript file please.

Contributor

nicm commented Jul 6, 2015

Run tmux in script(1) and reproduce and show me the typescript file please.

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 7, 2015

Done: http://paste.debian.net/279854 (the file contains some non-printing chars), base64-version: http://paste.debian.net/279855 . Done on Debian Jessie, tmux 1.9

safinaskar commented Jul 7, 2015

Done: http://paste.debian.net/279854 (the file contains some non-printing chars), base64-version: http://paste.debian.net/279855 . Done on Debian Jessie, tmux 1.9

@nicm

This comment has been minimized.

Show comment
Hide comment
@nicm

nicm Jul 7, 2015

Contributor

What exactly did you see printed after [exited] in this example?

On Tue, Jul 07, 2015 at 06:47:55AM -0700, Askar Safin wrote:

Done: [1]http://paste.debian.net/279854 (the file contains some
non-printing chars), base64-version: [2]http://paste.debian.net/279855 .
Done on Debian Jessie, tmux 1.9

--
Reply to this email directly or [3]view it on GitHub.

Reverse link: [4]unknown

References

Visible links

  1. http://paste.debian.net/279854
  2. http://paste.debian.net/279855
  3. #40 (comment)
  4. #40 (comment)
Contributor

nicm commented Jul 7, 2015

What exactly did you see printed after [exited] in this example?

On Tue, Jul 07, 2015 at 06:47:55AM -0700, Askar Safin wrote:

Done: [1]http://paste.debian.net/279854 (the file contains some
non-printing chars), base64-version: [2]http://paste.debian.net/279855 .
Done on Debian Jessie, tmux 1.9

--
Reply to this email directly or [3]view it on GitHub.

Reverse link: [4]unknown

References

Visible links

  1. http://paste.debian.net/279854
  2. http://paste.debian.net/279855
  3. #40 (comment)
  4. #40 (comment)
@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 8, 2015

I don't remember what I saw in that example, but I did new example ( http://paste.debian.net/280097 , http://paste.debian.net/280098 ) and I see this:

24  2015-07-08 11:16:01  ~$                                                                                                                          
[exited]-07-08 11:16:01  ~$                                                                                                                          
24  2015-07-08 11:16:08  ~$

safinaskar commented Jul 8, 2015

I don't remember what I saw in that example, but I did new example ( http://paste.debian.net/280097 , http://paste.debian.net/280098 ) and I see this:

24  2015-07-08 11:16:01  ~$                                                                                                                          
[exited]-07-08 11:16:01  ~$                                                                                                                          
24  2015-07-08 11:16:08  ~$
@nicm

This comment has been minimized.

Show comment
Hide comment
@nicm

nicm Jul 8, 2015

Contributor

This output looks fine to me, and if I try exactly what tmux is outputting in xterm it doesn't show anything odd. Possibly Konsole is either not redrawing correctly or not restoring the cursor position properly when exiting from cursor positioning mode. Does it happen for you in xterm or just in Konsole?

Contributor

nicm commented Jul 8, 2015

This output looks fine to me, and if I try exactly what tmux is outputting in xterm it doesn't show anything odd. Possibly Konsole is either not redrawing correctly or not restoring the cursor position properly when exiting from cursor positioning mode. Does it happen for you in xterm or just in Konsole?

@nicm

This comment has been minimized.

Show comment
Hide comment
@nicm

nicm Jul 8, 2015

Contributor

Oh, never mind, I see this too in xterm.

This appears to be just how it works, if you resize the terminal window while in cursor positioning mode (alternate screen) clearly it is deciding to put the cursor somewhere other than the end of the screen, so the [exited] that tmux prints ends up on a line which already had some text on it. It probably happens with the next line with your prompt too but you don't notice because it is the same text.

If you want your terminal to behave differently you will need to go and talk to the Konsole authors.

Contributor

nicm commented Jul 8, 2015

Oh, never mind, I see this too in xterm.

This appears to be just how it works, if you resize the terminal window while in cursor positioning mode (alternate screen) clearly it is deciding to put the cursor somewhere other than the end of the screen, so the [exited] that tmux prints ends up on a line which already had some text on it. It probably happens with the next line with your prompt too but you don't notice because it is the same text.

If you want your terminal to behave differently you will need to go and talk to the Konsole authors.

@nicm nicm closed this Jul 8, 2015

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 9, 2015

I just discovered that this bug doesn't happen with less --help, but does happen with mc and tmux. So, we should (for example) understand how less works and use their solution. So, please, reopen this bug.
Steps: open fresh terminal, maximize, type:

for ((I = 1; I <= 100; ++I)) { echo $I; }; tmux # or "less --help" or "mc"

Then (while the app running) restore normal window size, exit from the app. I see the following when I exit from less:

99
100
18  2015-07-09 06:27:04  ~$ _

i. e. all is OK. But I see the following when I exit from tmux:

76
77
[exited]
18  2015-07-09 06:26:48  ~$ _

i. e. numbers 78-100 are eaten.

Also, this bug is very important, because it causes data loss! My workflow is so: it is very important to me to see what previous commands I typed to terminal and what was their output. But sometimes I occasionally resize window while in tmux, and so part of my commands and the output is lost (like numbers 78-100 above)

safinaskar commented Jul 9, 2015

I just discovered that this bug doesn't happen with less --help, but does happen with mc and tmux. So, we should (for example) understand how less works and use their solution. So, please, reopen this bug.
Steps: open fresh terminal, maximize, type:

for ((I = 1; I <= 100; ++I)) { echo $I; }; tmux # or "less --help" or "mc"

Then (while the app running) restore normal window size, exit from the app. I see the following when I exit from less:

99
100
18  2015-07-09 06:27:04  ~$ _

i. e. all is OK. But I see the following when I exit from tmux:

76
77
[exited]
18  2015-07-09 06:26:48  ~$ _

i. e. numbers 78-100 are eaten.

Also, this bug is very important, because it causes data loss! My workflow is so: it is very important to me to see what previous commands I typed to terminal and what was their output. But sometimes I occasionally resize window while in tmux, and so part of my commands and the output is lost (like numbers 78-100 above)

@nicm

This comment has been minimized.

Show comment
Hide comment
@nicm

nicm Jul 9, 2015

Contributor

This is not a tmux issue, both before and after entering cursor positioning mode it has no control over what remains on the screen, that is completely up to the terminal. I suspect less works by coincidence, probably because it doesn't move the cursor or clear the screen, that is not practical for tmux.

Contributor

nicm commented Jul 9, 2015

This is not a tmux issue, both before and after entering cursor positioning mode it has no control over what remains on the screen, that is completely up to the terminal. I suspect less works by coincidence, probably because it doesn't move the cursor or clear the screen, that is not practical for tmux.

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 9, 2015

I am genius. :) Ahaha. :) You said this is terminal bug, right? Okey. :) But tmux can be seen as terminal, too. :) So, I can reproduce the bug such way that tmux acts both as terminal and simple app.

  • Start (outer) tmux
  • Type into it: for ((I = 1; I <= 100; ++I)) { echo $I; }; TMUX="" tmux and press Enter
  • (Now Ctrl-b will send commands to outer tmux and Ctrl-b Ctrl-b will send commands to inner tmux)
  • Ctrl-b " (tell outer tmux to open new pane, this will make inner tmux smaller)
  • Ctrl-b ; (tell outer tmux to switch to top pane, i. e. to inner tmux)
  • Ctrl-d (exit from inner tmux)

Now I see:

82
83
[exited]
34  2015-07-09 19:38:32  ~$ _

And I expected to see:

99
100
[exited]
34  2015-07-09 19:38:32  ~$ _

Tmux version: 1.9, all this done in Konsole 2.14.2 (KDE 4), but I think same will be in any other terminal, Debian Jessie.
Please, reopen :) (I hope reopening is possible here, on Github, right?)

safinaskar commented Jul 9, 2015

I am genius. :) Ahaha. :) You said this is terminal bug, right? Okey. :) But tmux can be seen as terminal, too. :) So, I can reproduce the bug such way that tmux acts both as terminal and simple app.

  • Start (outer) tmux
  • Type into it: for ((I = 1; I <= 100; ++I)) { echo $I; }; TMUX="" tmux and press Enter
  • (Now Ctrl-b will send commands to outer tmux and Ctrl-b Ctrl-b will send commands to inner tmux)
  • Ctrl-b " (tell outer tmux to open new pane, this will make inner tmux smaller)
  • Ctrl-b ; (tell outer tmux to switch to top pane, i. e. to inner tmux)
  • Ctrl-d (exit from inner tmux)

Now I see:

82
83
[exited]
34  2015-07-09 19:38:32  ~$ _

And I expected to see:

99
100
[exited]
34  2015-07-09 19:38:32  ~$ _

Tmux version: 1.9, all this done in Konsole 2.14.2 (KDE 4), but I think same will be in any other terminal, Debian Jessie.
Please, reopen :) (I hope reopening is possible here, on Github, right?)

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Jul 13, 2015

So, what? Please, at least reopen this bug, just to not forget about it

safinaskar commented Jul 13, 2015

So, what? Please, at least reopen this bug, just to not forget about it

@dminca

This comment has been minimized.

Show comment
Hide comment
@dminca

dminca Oct 16, 2015

Maybe executing tmux from script -c tmux could fix it, as explained here

dminca commented Oct 16, 2015

Maybe executing tmux from script -c tmux could fix it, as explained here

@safinaskar

This comment has been minimized.

Show comment
Hide comment
@safinaskar

safinaskar Oct 24, 2015

Didn't help

safinaskar commented Oct 24, 2015

Didn't help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment