[comp.sys.sun] Some Sun Bugs.

jeff@cjsa.wa.com (Jeffery Small) (10/14/89)

While porting a curses-based program to the Sun, I discovered the
following mixed bag of items which I pass along here for informational
purposes.  Most of these problems relate to using the System-V
environment.  I hope this saves someone else a few minutes of head
scratching.

These bugs were found on a 3/60 running SunOS 4.0.3.

1: /usr/5bin/sum will core dump if it is not given an argument.  This has
been reported and assigned bug id: #102-7099.

2: Contrary to the termcap/terminfo definitions supplied, it is NOT safe
to move the cursor while in standout mode on the sun console.  Curses
programs which make heavy use of standout mode (apparently vi does not
qualify here) will suffer all sorts of extremely confusing glitches as the
screen is being updated with the image.

You can fix this for Berkeley curses programs by editing /etc/termcap and
removing the "ms" entry from the sun descriptions.

To fix this for System-V terminfo-based curses programs you need to do the
following.

   A. Become root
   B. Make sure that TERM=sun
   C. Issue cmd:   /usr/5bin/infocmp > sun.terminfo
   D. Edit the new file "sun.terminfo" and remove the "msgr" entry.
   E. Issue cmd:   /usr/5bin/tic sun.terminfo

This will overwrite the sun, sun1 & sun2 entries in the
/usr/share/lib/terminfo/s directory.

   F: Set TERM=sun-cmd and then repeat steps C, D, E, & F to fix the entry
      for /usr/share/lib/terminfo/s/sun-cmd.


3: Here is a problem that relates specifically to sunview.

Do you ever map the sun-keyboard function keys (e.g. F2-F9) to macros in
vi?  If so, did you ever notice that sometimes your mappings just stopped
working and then they start working again for no apparent reason?  Then
you very probably have your sunview environment set up for "click-to-type"
window focus!

What I discovered is that when the mouse cursor is pushed over a window
frame (changing from the arrow into the circular target) then sunview
grabs control of ALL of the keyboard function keys - not just the keys
that it normally monitors, trapping the input from these keys and
discarding it.

Typically, I would click on the window I wanted to work in and then shove
the mouse cursor over towards the edge of the screen to get it out of the
way.  Sometimes it would land over the root pattern or within another
window and everything would work as expected.  Then occasionally, it would
land on a frame and the function keys would go dead!  By the way, this
affects not just vi, but any program which needs to use the function keys.

This has been reported to Sun and will hopefully be fixed.  In the
meantime, the workaround is to pay attention to where the mouse cursor is.


4: If you attempt to run a terminfo-based program, be aware that there is
a problem with approximately 100 of the terminfo definitions shipped with
SunOS 4.0.?  If these defective terminfo entries are referenced, they will
cause the program to core dump.  As best as I can determine, the problem
is with tic (the terminfo compiler) as I was once able to compile a custom
entry which caused the problem.  This has been reported to Sun but I have
not heard if they consider it a bug or not!

If you want to see if a specific entry is OK or not, then  cd to the
appropriate /usr/share/lib/terminfo/? directory and issue the command
"infocmp <file>" where <file> is the name of the definition you want to
check.  If the definition is OK, the contents of the file will be
displayed on the screen.  If the file is corrupted, then infocmp will core
dump.

The only workaround I can suggest is to extract the termcap entry for the
terminal you want to use and try to compile it into a working terminfo
file.  (See tic(8) & infocmp(8))

One final comment.  While curses programming is pretty passe' in this age
of windowing systems, if you find that you have a need for curses, give
the System-V terminfo-curses a close look.  I have been using curses for
years and never found a system using the original Berkeley curses which
did not have some major bug which causes severe programming headaches.
(However, things may have improved.)  The newer terminfo-based curses has
performed flawlessly for me (notwithstanding the terminfo database bugs
described above) and I have not found a single problem within the library.
The addition of pads, the expanded keypad/input routines and support for
numerous terminal attributes makes this a significantly improved product
but the real feature is that it works(!) so you don't have to be afraid of
doing something even just a little unconventional.

Jeffery Small    (206) 485-5596            uw-beaver!uw-nsr!uw-warp
C. Jeffery Small and Associates                                    !cjsa!jeff
19112 152nd Ave NE - Woodinville, WA  98072           uunet!nwnexus

mills@ccu.umanitoba.ca (10/18/89)

>4: If you attempt to run a terminfo-based program, be aware that there is
>a problem with approximately 100 of the terminfo definitions shipped with
>SunOS 4.0.?  If these defective terminfo entries are referenced, they will
>cause the program to core dump.  As best as I can determine, the problem
>is with tic (the terminfo compiler) as I was once able to compile a custom

I have discovered that the core dump is triggered by the presence of the
`rmacs' capability (exit alternate charset mode) in the compiled terminfo
file.  The file itself is not corrupted, but is correctly formatted by
tic, according to term(4).  BTW, this man page is not included with the
Sun SysV option.  I found it on another Unix system.  I wrote a program to
edit the compiled terminfo files and remove the `rmacs' and `smacs'
capabilities.  This eliminated the core dump.  Infocmp, tput, etc. all
work now.  This is superior to rebuilding the terminfo files from termcap
entries, because terminfo is supposed to have more capabilities.

-Gary Mills-             -University of Manitoba-             -Winnipeg-