bugGNU Screen - Bugs: bug #49883, Run mc inside screen + resize...

 
 

bug #49883: Run mc inside screen + resize terminal + ctrl-a esc + pgup pgup pgup = bug

Submitter:  Askar Safin <safinaskar>
Submitted:  Mon 19 Dec 2016 01:42:30 AM UTC
   
 
Category:  Program Logic Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Confirmed
Privacy:  Public Assigned to:  amade
Open/Closed:  Open Release:  4.4.0
Fixed Release:  None Planned Release:  4.6.0
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 15 Jul 2017 02:14:28 PM UTC, comment #9: 

Hi,

Since upgrading to screen 4.6.0 I have having issues with cursor placement after leaving altscreen. I looked through the history and found commit 8062db33b87ed86ec54222c83babbf1aa5866ec9, which refers to this bug. Reverting that commit fixes the problem.

Steps to reproduce:
1. Start screen with altscreen on
2. Press enter at your shell prompt until you reach the bottom of the screen
3. Run 'echo foo | less'
4. Press 'q' to exit

Expected behaviour:
The cursor should be at the bottom of the screen, just like it was before I started less.

Actual behaviour:
The cursor is in the middle of my history, somewhere near the top of the screen.

I'm running Arch Linux, up to date as of today. less 487, screen 4.6.1, ncurses 6.0+20170527, glibc 2.25, Linux 3.16.45.

Happy to test any patches, thanks!

James Bunton <delx>
Thu 13 Apr 2017 08:53:13 AM UTC, comment #8: 

Uh.. right, reopen, while I work on another fix...

Amadeusz Sławiński <amade>
Group administrator
Tue 11 Apr 2017 08:32:18 AM UTC, comment #7: 

I tested again.
"altscreen on" really (something like) ignored now.

Steps I used.

My host system is debian stretch. I run this command (to create chroot environment with another debian stretch in it):

$ sudo debootstrap --variant=minbase stretch /tmp/s http://ftp.debian.org/debian

Then, in newly created system:

# apt-get install mc
# apt-get install gcc make git
# git clone https://git.savannah.gnu.org/git/screen.git # commit a48e1f96dc329cd0fc28ed91890dd19f4d12a47c
# cd screen
# cd src
# apt-get install automake autoconf
# ./autogen.sh
# apt-get install libc6-dev
# apt-get install libncurses5-dev
# ./configure --prefix=/opt/screen-2017-04-11
# make
# make install
# apt-get install systemd-sysv systemd
# passwd -d root

Then, at host we boot this chroot environment using systemd-nspawn:

$ sudo systemd-nspawn -bD /tmp/s

Then, in newly booted container:

# mcedit ~/.screenrc
# cat ~/.screenrc
altscreen on
startup_message off
# /opt/screen-2017-04-11/bin/screen

Then I see "startup_message off" took effect (so, screen uses this config), but "altscreen on" is ignored.

If you want, I can send you this chroot environment.

---

Also, I just noticed this: your example works. I. e. if I run big "ls" and then "mc", then "altscreen" works. But if I type "mc" as first in command in screen, then "altscreen" doesn't work (unlike stretch's version, i. e. "Screen version 4.04.00 (GNU) 19-Jun-16")

Askar Safin <safinaskar>
Sun 09 Apr 2017 09:42:00 AM UTC, comment #6: 

Hey,

not sure what happened, but either you must have accidentally done something wrong or I need better steps, as for me it seems to work just fine.

After I do 'ls -la' and then run 'mc' output of ls still stays in view, all with one line config (altscreen on).


(...)
-rw-r--r-- 1 amade amade    2674 04-09 11:26 winmsgbuf.h
-rw-r--r-- 1 amade amade   24088 04-09 11:27 winmsgbuf.o
-rw-r--r-- 1 amade amade    3386 04-09 11:26 winmsgcond.c
-rw-r--r-- 1 amade amade    1525 04-09 11:26 winmsgcond.h
-rw-r--r-- 1 amade amade    8416 04-09 11:27 winmsgcond.o
amade@pecet ~/workdir/gnu/screen/src $ mc

amade@pecet ~/workdir/gnu/screen/src $

Amadeusz Sławiński <amade>
Group administrator
Sat 08 Apr 2017 08:01:34 PM UTC, comment #5: 

Now "altscreen on" doesn't work.

I built current master, installed it to /opt/screen-2017-04-08 , then added "altscreen on" to ~/.screenrc and /etc/screenrc , then I run /opt/screen-2017-04-08/bin/screen -c ~/.screenrc , but "altscreen on" has no effect.

I run screen, then I run mc inside it, then I exit from mc and I see a lot of empty space before prompt exactly as in very first message in this bug report.

Askar Safin <safinaskar>
Thu 06 Apr 2017 09:37:21 AM UTC, comment #4: 

So did some more thinking and applied better fix.
Available in both screen-v4 and master branches.
Will be in next release.

Amadeusz Sławiński <amade>
Group administrator
Thu 12 Jan 2017 03:19:28 PM UTC, comment #3: 

Confirmed, when using altscreen we restore cursor position before we leave altscreen.This was changed by https://savannah.gnu.org/bugs/?35757 so we don't want to break this. Easiest fix seems to be to restore cursor position before and after leaving altscreen.

Will have a fix ready after some testing.

Amadeusz Sławiński <amade>
Group administrator
Tue 10 Jan 2017 01:06:37 AM UTC, comment #2: 

Thanks, now described bugs disappeared.
But now appeared that tmux bug I just described as "be careful not to introduce". I will try to repeat it simpler.

  • Start screen (with altscreen on)
  • Type into it: "for ((I = 1; I <= 100; ++I)) { echo $I; }; mc" and press Enter
  • Make the terminal (for example, gnome-terminal) 3 (or more) lines smaller vertically
  • f10 (or esc 0) (exit from mc)


Now I see:

86
87
88
89
90
  2017-01-10 04:04:05  ~$
92
93
94
95
96
97
98
99
100


And I expected to see:

99
100
  2015-07-09 19:38:32 ~$ _

Askar Safin <safinaskar>
Mon 09 Jan 2017 09:11:24 PM UTC, comment #1: 

Hello,

can you add
altscreen on
to your .screenrc and check if you still have problems. Seems to me like you don't have this setting enabled.

Amadeusz Sławiński <amade>
Group administrator
Mon 19 Dec 2016 01:42:30 AM UTC, original submission:  

(All described behavior happens in "normal" terminal such as gnome-terminal and not in "dumb" terminal such as linux console)

Run screen, then run mc in it, then exit from mc. You will see this:

[ Lot of empty space ]
$ _

So, all previous commands and their output moved up (to scrollback) and now they are accessible using ctrl-a esc only. What should be instead? Instead terminal should come to state in which it was before mc startup. I. e. all output should be here. I should see this:

$ mc

$ _

I. e. I should see "mc" command I used to run mc, then one empty line and the current line with cursor. I. e. I should see same that happen without screen involved. tmux has no this bug.

Okey, now let me say about next bug. Open screen, then open mc inside it. Then resize your outer terminal (this will cause resizing of screen, of course). Then exit from mc, type ctrl-a esc and type pgup several times. You will see that your scrollback contains a lot of copies of mc (with different sizes). This is wrong. Scrollback should contain same text it contained before starting of mc. Again, tmux has no this bug.

But when fixing this bug be careful not to introduce yet another bug. tmux has bug:

  • Start tmux
  • Type into it: "for ((I = 1; I <= 100; ++I)) { echo $I; }; mc" and press Enter
  • Ctrl-b " (tell tmux to open new pane, this will make mc smaller)
  • Ctrl-b ; (tell tmux to switch to top pane, i. e. to mc)
  • f10 (or esc 0) (exit from mc)


Now I see:

82
83

34  2015-07-09 19:38:32  ~$ _

And I expected to see:

99
100

34  2015-07-09 19:38:32  ~$ _

So, tmux "eats" numbers 84..100.
So, tmux has this bug and screen has not. When you fix bugs described at the beginning of this report, be careful not to introduce this tmux's bug I described here.

$ screen --version
Screen version 4.04.00 (GNU) 19-Jun-16

Askar Safin <safinaskar>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by delx (Posted a comment)
  • -email is unavailable- added by amade (Posted a comment)
  • -email is unavailable- added by safinaskar (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-04-13 amade StatusFixed Confirmed
    2017-04-06 amade StatusConfirmed Fixed
        Planned ReleaseNone 4.6.0
    2017-01-12 amade StatusNeed Info Confirmed
        Assigned toNone amade
    2017-01-09 amade StatusNone Need Info

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code