Mantis - mutt
Viewing Issue Advanced Details
3648 regular use block always 2009-04-29 07:59 2010-03-15 11:59
meunier  
dam  
normal  
closed  
won't fix  
none    
none  
0003648: mutt does not work with screen's altscreen because it is compiled with slang instead of ncurses
/opt/csw/bin/mutt is compiled with slang, not ncurses, while /opt/csw/bin/screen is compiled with ncurses, not slang. So if you use /opt/csw/bin/screen and start /opt/csw/bin/mutt inside it, it looks like the ncurses library used by screen and the slang library used by mutt fight each other in a bad way when screen's altscreen feature is enabled.

Here is a way to reproduce the problem:

[after ssh-ing into a Solaris machine from an xterm]
$ export $TERMINFO=/opt/csw/share/terminfo/
$ /opt/csw/bin/infocmp
# Reconstructed via infocmp from file: /opt/csw/share/terminfo/x/xterm
[blablabla ... so the correct terminfo database is being used]
$ ls
[blablabla]
$ /opt/csw/bin/emacs
[exit emacs, the screen returns to its previous content, including showing the output of the previous 'ls' command. Note: this will not work and the ouput of the previous 'ls' command will be invisible if your TERMINFO environment variable is not set correctly]
$ ls
[blablabla]
$ /opt/csw/bin/mutt
[exit mutt, the screen returns to its previous content, including showing the output of the previous 'ls' command]
$ /opt/csw/bin/screen
[screen is cleared]
$ ls
[blablabla]
$ /opt/csw/bin/emacs
[exit from emacs, the cursor is at the bottom of the xterm and the output of the previous 'ls' is not visible anymore]
$ ls
[blablabla]
$ /opt/csw/bin/mutt
[exit from mutt, the cursor is at the bottom of the xterm and the output of the previous 'ls' is not visible anymore]

So far so good. Emacs and mutt normally use xterm's "alternate screen" feature which is why the output of the previous 'ls' command is visible in the xterm once emacs or mutt has exited. Screen, on the other hand, does not provide an alternate screen by default, so emacs and mutt just use the "regular screen" and the output of the previous 'ls' command is then lost when emacs or mutt exits.

Now type:

Control-A :

to get the interactive prompt from 'screen', then type:

altscreen on

then you should get a 'Will do alternate screen switching' from 'screen'. This tells 'screen' that it should provide an alternate screen to applications like emacs or mutt that normally use xterm's alternate screen feature.

Now let's try emacs and mutt again:

$ ls
[blablabla]
$ /opt/csw/bin/emacs
[exit emacs, the screen returns to its previous content, including showing the output of the previous 'ls' command, just as if emacs were run from a normal shell instead of being run from within 'screen'. Great, that's what I want.]
$ ls
[blablabla]
$ /opt/csw/bin/mutt
[oops, watch screen and mutt fight for control of the alternate screen... You can try to type a quick random combination of

x

and

Control-A "

to tell mutt to exit and screen to give you a list of virtual screens (rather than fighting with mutt) but good luck with regaining control of your window...]

Now, the fact that emacs works fine in combination with screen's altscreen feature but that mutt does not tells me that the problem is with mutt, not screen. After investigating a little, I've come to the conclusion that the problem is not with the code of mutt itself, but with the fact that /opt/csw/bin/mutt uses slang while /opt/csw/bin/screen uses ncurses. In fact I have compiled (with gcc) a version of mutt 1.5.19 with ncurses 5.7 which works perfectly well in the examples above. On the other hand the same version of mutt 1.5.19 compiled with slang 2.1.4 fails just like /opt/csw/bin/mutt, flashing the screen and all. My /opt/csw/bin/mutt uses slang 1.4.8, not slang 2.1.4, but that doesn't seem to make any difference, both fail in the same way.

So is there a way to get /opt/csw/bin/screen to be compiled with ncurses rather than slang, by any chance?

Thanks,

Issue History
2009-04-29 07:59 meunier New Issue
2009-05-07 18:48 philadmin Note Added: 0006074
2009-05-07 18:48 philadmin Status new => closed
2009-05-07 18:48 philadmin Resolution open => won't fix
2010-01-14 23:53 dam Note Added: 0007236
2010-01-16 14:35 skayser Note Added: 0007267
2010-01-16 21:38 dam Status closed => assigned
2010-01-16 21:38 dam Assigned To => dam
2010-01-16 21:39 dam Note Added: 0007269
2010-01-16 21:39 dam Status assigned => feedback
2010-02-19 22:52 dam Note Added: 0007482
2010-02-22 10:47 meunier Note Added: 0007490
2010-03-15 11:59 dam Note Added: 0007645
2010-03-15 11:59 dam Status feedback => closed

Notes
(0006074)
philadmin   
2009-05-07 18:48   
Thank you for your detailed investigation and writeup of the problem.

Unfortunately, mutt works better with slang. so, i'm not going to recompile it with ncurses. sorry.
(0007236)
dam   
2010-01-14 23:53   
Phil, could you refine what "better" means in this context? If it is really necessary to have a slang'ed mutt it is mandatory to have a second one ("muttnc" for ncurses?) for maximum interoperability.
(0007267)
skayser   
2010-01-16 14:35   
Dago, I assume by "works better with slang" Phil was referring to 0002942 "Broken TERM=xterm terminal handling with 1.5.18,REV=2008.11.03?" which I encountered a couple of months before.

The root cause for this was that our ncurses terminfo contained an entry for xterm which described the current xterm implementation, not the stock one shipped with Solaris. You fixed this for good (after chatting with Thomas Dickey) by shipping the more conservative xterm terminfo entry with ncurses, remember?

In the meantime Phil simply recompiled mutt against slang which either works against the stock Solaris terminfo database or has some other means to determine terminal capabilities (haven't looked into it yet).

Anyway, with our adjusted terminfo database, I don't see any problem at all with compiling mutt against ncurses now ... apart from Phil's dislike of ncurses maybe ;P
(0007269)
dam   
2010-01-16 21:39   
Packages with mutt compiled against slang and ncurses are in testing/:
  http://mirror.opencsw.org/testing.html [^]
Please verify

mutt_base-1.5.20,REV=2010.01.16-SunOS5.8-sparc-CSW.pkg.gz
mutt_ncurses-1.5.20,REV=2010.01.16-SunOS5.8-sparc-CSW.pkg.gz
mutt_slang-1.5.20,REV=2010.01.16-SunOS5.8-sparc-CSW.pkg.gz

mutt_base-1.5.20,REV=2010.01.16-SunOS5.8-i386-CSW.pkg.gz
mutt_ncurses-1.5.20,REV=2010.01.16-SunOS5.8-i386-CSW.pkg.gz
mutt_slang-1.5.20,REV=2010.01.16-SunOS5.8-i386-CSW.pkg.gz
(0007482)
dam   
2010-02-19 22:52   
Version 1.5.20,REV=2010.02.19 has been released to current with alternatives support to peristently select a version either with ncurses or slang called "mutt". Select with
  /opt/csw/sbin/alternatives --config mutt
(0007490)
meunier   
2010-02-22 10:47   
Thanks a lot guys, but unfortunately in the 10 months since I reported the issue my organization has switched to Linux, so I cannot test your packages anymore and the whole issue has in fact become moot for me. Well, hopefully it will benefit someone else in the future...
(0007645)
dam   
2010-03-15 11:59   
This has been fixed in 1.5.20,REV=2010.02.19 and released to current/.