OpenCSW Bug Tracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004133 [screen] packaging feature N/A 2010-01-09 18:28 2010-06-14 22:19
Reporter skayser View Status public  
Assigned To yann
Priority low Resolution fixed  
Status closed  
Summary 0004133: Color support impaired, screen windows default to TERM=vt100
Description Screen is linked to the standard Solaris curses which doesn't know about "screen" in its terminfo database (/usr/lib/share/terminfo). Thus, screen windows default to TERM=vt100 and even "screen -T screen" reverts back to TERM=vt100. The problem with this is that the vt100 terminfo entry doesn't support colors, so applications like vim running inside screen don't colorize their output even though screen comes with color support.

To work around it, one can point the system curses libs to the terminfo database that comes with CSW ncurses (it contains a terminfo description for screen) and then start screen. "TERMINFO=/opt/csw/share/terminfo screen". This way screen windows default to TERM=screen and color support for applications running inside these windows is working. This is a workaround though.

As a possible fix from the packaging side, screen could be compiled against CSW ncurses (for comparison: the screen from is also linked against their ncurses). Then the terminfo database defaults to /opt/csw/share/terminfo and screen windows would have TERM=screen as described above. The problem with this approach would be that applications linked against system curses (like /usr/bin/less) running inside our CSW screen would be presented with TERM=screen which is unknown to their /usr/lib/share/terminfo database.

I don't see this as a major problem though: users are already advised to put /opt/csw/bin first in their $PATH. If we make sure that our packages are built against CSWncurses, our stack is fully functional within such a screen and comes with functional color support out of-the-box. "Legacy" tools linked against system curses which are running inside such a screen session would require the TERMINFO workaround from above to understand TERM=screen or would need to be run with TERM=vt100.

Filing this as a "feature request", which is up for discussion. Right now, there is no out-of-the-box color support within screen windows.
Additional Information $ pkgparam CSWscrn VERSION

$ /opt/csw/bin/screen -T screen -c /dev/null
$ echo $TERM
$ ldd /opt/csw/bin/screen | grep curses => /lib/
$ exit
[screen is terminating]

$ TERMINFO=/opt/csw/share/terminfo screen -c /dev/null
$ echo $TERM

Emulating system curses terminfo lookups (for color capabilities set_a_background and set_a_foreground):

$ ldd /usr/bin/infocmp | grep curses => /lib/
$ TERM=vt100 /usr/bin/infocmp -1L | grep set_a_
$ TERM=screen /usr/bin/infocmp -1L | grep set_a_
Sorry, I don't know anything about your "screen" terminal.
$ TERMINFO=/opt/csw/share/terminfo TERM=screen /usr/bin/infocmp -1L | grep set_a_
  set_a_background = '\E[4%p1%dm'
  set_a_foreground = '\E[3%p1%dm'

Emulating CSW curses terminfo lookups:

$ ldd /opt/csw/bin/infocmp | grep curses => /opt/csw/lib/sparcv8/
$ TERM=screen /opt/csw/bin/infocmp -1L | grep set_a_
Tags No tags attached.
Attached Files

- Relationships

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

related to 0004143closedbonivart cswclassutils cswmigrateconf should print the warning only when necessary 
related to 0004397closeddam ncurses Split off CSWterminfo package? 

-  Notes
skayser (administrator)
2010-01-09 21:17

In case screen would be re-compiled against ncurses: an option to make the more comprehensive ncurses TERMINFO location known to all applications launched in screen could be to ship a system wide screenrc (/opt/csw/etc/screenrc currently) which contains

setenv TERMINFO /opt/csw/share/terminfo
yann (developer)
2010-01-09 21:18

Thanks for your detailed bug report.

After reading your explanation, I think I will:

 - compile screen with CSW ncurses
 - provide a /etc/opt/csw/screenrc file with the following content:
setenv TERMINFO /opt/csw/share/terminfo

This would allow everything to work whatever the origin of the command launched (CSW or not) and would be transparent for the user.

yann (developer)
2010-01-11 14:12

You will find fixed packages in testing:,REV=2010.01.10-SunOS5.8-i386-CSW.pkg.gz [^],REV=2010.01.10-SunOS5.8-sparc-CSW.pkg.gz [^]

Could you test if that packages work correctly in your environment ?

I included cswmigrateconf class action script to migrate configuration from /opt/csw/etc/screenrc to /etc/opt/csw/screenrc in case someone manually created a system-wide screenrc file, but I will probably wait for an answer on this bug: [^]
before releasing the package.
skayser (administrator)
2010-01-11 20:48

Thanks Yann! Package looks good to me on first sight. Will run it another two days with my typical usage to see whether anything unexpected pops up.

There is one minor glitch: when someone opens this build of screen and SSHs to another systems his TERM=screen settings will be carried over automatically by SSH, but his $TERMINFO won't. So if the target system happens to be a Solaris system also (or one where some of the applications don't understand TERM=screen) we will, depending on the application, have the "unknown term" issue again.

In my opinion this is again a minor problem though. We can't take care of all systems that a user has access to. And if those target systems don't understand TERM=screen that's their fault (sounds harsh, but that's the way I perceive it).

What we can do though, is to offer a documented workaround in README.CSW. Right now for example, I use the following screen command to open a SSH to affected systems while still carrying over the TERMINFO variable (no need to tweak sshd_config and ~/.ssh/environment).

:screen -t build10x ssh -t build10x "TERMINFO=$TERMINFO $SHELL"

Another easy option might be to simply call ssh with an overriden TERM

TERM=vt100 ssh

That defeats color support again, but well ...
skayser (administrator)
2010-03-05 12:46

cswmigrateconf adjustments from 0004143 look good, just tested them and provided feedback. Now the only thing missing is an updated cswclassutils package (AFAIK Peter is already working on tying it together, so it should be out the door soonish).
skayser (administrator)
2010-04-08 10:10

Fix for the related cswmigrateconf issue (0004143) went into cswclassutils 1.33 (1.34 is already in the catalog). Can we get the updated screen packages out of the door? :)
yann (developer)
2010-04-09 22:15

Fixed package submitted to Phil.
skayser (administrator)
2010-04-15 20:37

After a brief discussion with Phil (who would like to avoid the ncurses dependency), I revisited this issue and the

  setenv TERMINFO /opt/csw/share/terminfo

in the global screenrc file doesn't only make subprocesses happy when it comes to terminal capabilites, but also screen itself - even when screen is *not built against our ncurses*. Screen will pick up our terminfo db and screen windows properly default to "screen".

Currently, this doesn't make the dependency on CSWncurses obsolete though because our terminfo db is part of CSWncurses. Already a while ago, Maciej changed the ncurses build recipe to split off a CSWterminfo package, but it hasn't yet been released as such. Will ping him and/or file a bug against ncurses.
yann (developer)
2010-04-15 21:17

Feel free to link the bug against ncurses against this one.

I don't think it's to useful to add a CSWncurses depandancy if I will remove it soon after.
I will probably wait for ncurses to be fixed.
dam (administrator)
2010-04-19 14:04

Is this really a problem? Wouldn't it be easier to just link against CSWncurses instead of splitting the package and tweaking TERMINFO in lots of locations?
skayser (administrator)
2010-04-21 10:42

TERMINFO needs to be set anyway for subprocesses within screen which are not built against CSWncurses. That's an easy thing to do, Yann already prepared a global screenrc for this (read: _one_ location).
dam (administrator)
2010-05-25 22:44

CSWterminfo is now available, please proceed.
yann (developer)
2010-06-14 22:18

Fixed packages uploaded

Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker