[comp.unix.wizards] Vi fails on a Sun-4

bertrand@eiffel.UUCP (Bertrand Meyer) (08/16/90)

Has anyone run into the following problem, which
is becoming an increasing nuisance for me?

Vi (on a Sun-4, running SunOS 4.0) fails
according to totally unpredictable patterns.

For example (vg is an alias that uses vi):

>   [Rome] bm 592 - vg instruction
>   Illegal instruction (core dumped)
>   [Rome] bm 593 - vi Grammar/instruction
>   Illegal instruction (core dumped)
>   [Rome] bm 594 - vi Grammar/instruction
>   Illegal instruction (core dumped)
>   [Rome] bm 595 - cd Grammar
>   [Rome] bm 596 - vi instruction
>   Illegal instruction (core dumped)

	I have experienced similar problems for a long
time, but it used to be only when calling vi with
several file arguments (I have many scripts which do
this, based on grep searching). Now, as the above shows,
it's occurring even with just one file!

Another example occurred as I was trying to send mail
(describing the problem!) and the ~v command of mail
failed with ``Fatal error in "usr/ucb/vi"''.

The problem does not occur identically in different
windows. Usually command windows fail less often than
shell windows. Yesterday, I experienced a situation
with two windows, where vi would work in window A
(a command window) except if the number of file arguments
was equal to 2, and would work in window B (a shell
window) for 1 or 2 arguments, but apparently for no
other number of arguments!

I would be grateful if anyone has any suggestion about
what is going on (other than ``switch to Emacs'').
A text editor seems a pretty basic tool to me, and
after all these years one might hope that vi would
work. I don't suspect Bill Joy reads this, however.

I would appreciate mail replies to bertrand@eiffel.com.
If I receive anything of general interest I will post a
summary.

Thanks in advance.

-- Bertrand Meyer
Interactive Software Engineering, Santa Barbara, CA.

bertrand@eiffel.com

bertrand@eiffel.UUCP (Bertrand Meyer) (08/17/90)

In the article referenced above I mentioned a problem
I was having with vi under csh, failing in inexplicable
ways on a Sun-4 running 4.0.

Many thanks to the several people who responded overnight
and allowed me to correct the problem. For the benefit
of others, here is one of the responses by Nick W. Holloway,
I believe from the University of Warwick:

> This is a bug with SunOS 4.0 (even up to 4.0.3).  If the size of your
> environment and the arguments passed to vi are of a magic size, then vi
> will core dump with an illegal instruction.  It is not unique to vi, it
> just happens that it occurs frequently with vi.  If you have access to
> back issues of sunspots, have a look at the message in Volume 7, Issue
> 26, Subject "Obscure SunOS Bug".  This particular bug is fixed in 4.1.
> 
> I imagine the reason that it fails differently in different windows is
> that the environment is different sizes.  To see this, try using the
> command 'printenv | wc -c'.
> 
> The workaround is to just put some junk environment variables in your
> environment to take it over this magic number, or remove some to take
> it under.

The workaround suggested by Mr. Holloway (and several
others in essentially equivalent terms) does work so far
for me.

Thank you very much.
-- 
-- Bertrand Meyer
bertrand@eiffel.com