- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Subshell output lost on window resize under tmux, GNU screen #3639
Comments
Cause:
|
|
The patch above adds a check for how == QUIETLY to skip the call to tty_change_screen_size when panels are hidden.
This fixes the problem for me and seems not to introduce any regression with the ncurses build. I have not tested it extensively, though. |
I should probably add that libslang2 is version 2.3.0 here. |
Branch: 3639_subshell_output_lost |
I've pushed amended commit as [a435037bad30c7e5dafbe31c0f3cc38230c459a9], because your commit message formatting is unreadable, do you think you could take that instead?
Otherwise, I can surely vote for the branch, because it looks innocent enough, but generally this kind of patches always makes me feel bad: sadly, we don't have any integration tests to cover this, and not only it's unclear if this will subtly break something or not, but also it's not guaranteed that it will not be broken by some other change in the future :-/ |
|
|
|
Replying to zaytsev:
Apparently it was broken ever since the migration to S-Lang, and nobody noticed or got sufficiently annoyed. I did only because I use a tiling window manager which tends to slightly resize windows every time a new window appears. |
Ha-ha-ha, I did have a bad feeling about this patch, and, sure enough, right after release, I have bisected a very annoying bug as being caused by [c4a888], f%&@*!
So, I have i3 / gnome-terminal on Ubuntu 14.04 here:
1) Switch to an empty workspace
Press Ins repeatedly to enjoy watching vim absolutely confused about the window size and completely unusable. What's more annoying is that an explicit WINCH via Super + F doesn't help it.
@yurikhan, you're saying that you're using a tiling window manager, can you reproduce it?
Not an absolutely critical show-stopper, but unless there is a better solution, I would rather revert it altogether... mc is still losing subshell output in screen / tmux on Ctrl + O, so screen / tmux users are accustomed to constant pain anyways. |
Replying to zaytsev-work:
Let’s minimize your recipe:
Expected: $COLUMNS and $LINES track the current window size.
Observed: $COLUMNS and $LINES stay the same.
Presumably because the WINCH goes to MC which, because of this patch, does not pass it downstream.
I will work on a better solution.
Still losing, with the previous patch? Tell me more. I was intending to end this pain with this and #3640. |
Please revert [c4a888] and try this one instead. |
A less invasive attempt |
Hi Yuri, thanks for getting back to me!
I have reverted the old patch and tried the new one, and it seems to fix the problem that I'm observing.
As mentioned above, do you have any idea on how this can be tested in an automated fashion, so that it doesn't get broken next time any "fixing" is done on the SLang layer? One could possibly try to set up integration tests with mc2, but it's not merged yet and frankly speaking I have no idea as to if and when this will happen. On the unit test level, one could possibly try to check mock behaviors if the code was encapsulated well enough, but I'm not sure it's even practical at the moment.
I'm not exactly sure what the intent of #3640 was, but I understood that it had to do something with cursor position on window resizes, which, apparently, is important for some reason.
In my case, I wasn't losing subshell output upon window resizes, but upon panel flips in screen, even if the window size stays constant. I can reproduce it with 4.8.17 on Ubuntu 14.04 & screen as follows:
This has been around for a very long while, and it seems that there is no change with #3640. |
I have to add that I've just tried tmux, and, to my amazement, I can confirm that it doesn't loose subshell output, be it 4.8.16 or 4.8.17... not sure about cursor position, I haven't got time to check this any more attentively yet.
Maybe I should bit the bullet and ditch screen for tmux, even though last time I tried it, I failed, because tmux felt painfully slow for some reason, and I'm just too used to screen quirks. |
Replying to zaytsev-work:
Perhaps mock the terminal and possibly the user, and add lots of test cases like:
etc.
Unfortunately I cannot propose a fully ready-made solution for mocking the terminal. I know of this Python library called pyte which might be up to the task, but it would need to be somehow integrated with the test framework. In fact, even a C terminal emulation library would need non-trivial integration.
It is important because losing the cursor position causes the next page of output to overwrite the last one.
Is your screen configured for alternate screen switching? By default, it is not; you’d need an altscreen on line in your .screenrc. tmux, on the other hand, does alternate screen out of the box. |
Hi Yuri, thanks again for your input!
I've tried it with altscreen on, and screen doesn't loose the output with this patch anymore, also when the window is resized :-) Moreover, out of curiosity, I've also tried 4.8.16, and managed to trigger a segfault after a few resizes o_O You've done a great job!
Oh, I see, that's a nice idea. I've also heard of pyte, but I didn't realize that it can be very useful for this purpose.
The integration in the testing framework is the easiest part. Autotools come with a simple test harness out of the box, basically, all you need is a script that returns zero on success, and non-zero on failure. I can certainly hack something up and get Travis to run it.
The most difficult part for me would be to write the test cases themselves :-/ I'm afraid that unless you can lend us a hand, in the end, we'll just have to commit this one as usual, without tests... Oh well. |
Replying to zaytsev:
That looks not very hard but annoyingly fiddly.
What we have is a system consisting of two components, the terminal emulator and the application, connected by an RPC channel with an escape sequence–based protocol over stdin/stdout. Moreover, there are two implementations of the protocol (ncurses and slang) and they do not generate strictly equivalent traffic.
A test case would contain some setup/teardown code on both sides of the channel. Additionally, it would need to perform actions on the application side and observe effects on the terminal side, or vice-versa. Assuming pyte as the virtual terminal emulation library, we need the following sequence:
The ??? in steps 5 and 7 indicate some kind of interprocess synchronization, so that the outer script knows when to check the result and then the subprocess knows when to resume teardown.
Maybe we could hijack stdin/stdout in-process and just analyze the bytes that are written on stdout. Maybe there is a virtual terminal library that is usable from C, also in-process. This would simplify testing because that kind of synchronization wouldn’t be necessary. |
I might have made an impression that I’m working on automated tests for this ticket. I’m sorry but I’m not. IMO that should be a different ticket. |
Branch: 3639_subshell_output_lost_fix |
|
|
Unit test by Michael Gold <michael@bitplane.org>, I wish we could add this to the check thing...
https://bugs.debian.org/825974
Still too overwhelmed to try to address it myself :-( |
Important
This issue was migrated from Trac:
yurikhan
(yuri.v.khan@….com)and
To reproduce:
Expected behavior: shell output remains on screen (suitably padded or truncated to new window size).
Observed behavior: screen is cleared, with cursor remaining at the same position.
Versions:
Note
Original attachments:
yurikhan
(yuri.v.khan@….com) onMay 3, 2016 at 5:54 UTC
yurikhan
(yuri.v.khan@….com) onMay 9, 2016 at 12:14 UTC
zaytsev
(@zyv) onJul 10, 2016 at 17:28 UTC
The text was updated successfully, but these errors were encountered: