[comp.sys.apollo] Weird vi bug

ack@caldwr.caldwr.gov (David Ackerman) (11/14/87)

We discovered a very strange bug in Apollo implementation of vi, at least the
version we have. If the characters "ei:X:" are in a text file that you try to
edit with vi, it will try to interpret the X char as a command. For instance,
the line

ei:5:

will elicit the statement, "Not that many lines in buffer", if there aren't
that many lines, or it will take you to line 5 in the buffer. Or

ei:g:

will give you "Missing regular expression for global". I have never seen this
type of behavior in any of the versions of vi I have used before. Has anyone
else ever experienced this, or is it just us?

BTW, we are running SR 9.5.


David Ackerman
California Department of Water Resources         caldwr!ack@ucdavis.edu  (Internet)
"It's the water, and a lot more..."       ...!ucbvax!ucdavis!caldwr!ack  (UUCP)

         The opinions expressed above are mine, not those of the State
         of California or the California Department of Water Resources.

paul@FLEETWOOD.CC.UMICH.EDU ('da Kingfish) (11/16/87)

David Ackerman <ack%caldwr.uucp@ucdavis.ucdavis.edu> says ...

	We discovered a very strange bug in Apollo implementation of vi, at least the
	version we have. If the characters "ei:X:" ...

That's an undocumented "feature" of vi, and was not added by Apollo.
If you have a file that has what looks like ex/vi commands in the first
line, I believe, those commands will be executed.  The idea was to
customize vi on a file by file basis.

There are enough problems with this that many people changed vi locally
not to do this.  I think recent versions of vi may have it turned off,
I don't know.

--paul

barnett@vdsvax.steinmetz.UUCP (Bruce G Barnett) (11/17/87)

In article <8711152200.AA04047@fleetwood.cc.umich.edu> paul@FLEETWOOD.CC.UMICH.EDU ('da Kingfish) writes:
|David Ackerman <ack%caldwr.uucp@ucdavis.ucdavis.edu> says ...
|
|	We discovered a very strange bug in Apollo implementation of vi, at least the
|	version we have. If the characters "ei:X:" ...
|
|That's an undocumented "feature" of vi, and was not added by Apollo.
|If you have a file that has what looks like ex/vi commands in the first
|line, I believe, those commands will be executed.  The idea was to
|customize vi on a file by file basis.

As I recall, the syntax was intended to be
	ex:...
or
	vi:....
but the parsing does a [ev][xi], so
	ei:...
and
	vx:....
also match. Ain't ad hoc parsers grand! :-)

-- 
	Bruce G. Barnett 	<barnett@ge-crd.ARPA> <barnett@steinmetz.UUCP>
				uunet!steinmetz!barnett

rcodi@yabbie.rmit.oz (Ian Donaldson) (11/26/87)

in article <130@caldwr.caldwr.gov>, ack@caldwr.caldwr.gov (David Ackerman) says:
> will give you "Missing regular expression for global". I have never seen this
> type of behavior in any of the versions of vi I have used before. Has anyone
> else ever experienced this, or is it just us?
> 
> BTW, we are running SR 9.5.

Its standard in 4.2 vi (ex3.7) too, and not specific to the apollo version.  
Probably many others as well.  What is supposed to happen is the string:

	ex:
or
	vi:

be recognized, at the start of the file, but due to the way its coded in ex, 
it only checks that the first letter be 'e' or 'v' and the 2nd letter be 'x' 
or 'i', but doesn't check the combinations, so that:

	ei:
and
	vx:

are also triggers for the startup command string.

Ian D