[net.bugs.4bsd] fun bug in vi

guy@sun.uucp (Guy Harris) (05/25/85)

> An undocumented feature in vi allows a valid command in the file being 
> 'edited' of the form
> 
> 	...ex:{command}:
> or
> 	...vi:{command}:
> 
> to be actioned before interactive editing is allowed.  However, the bug
> also permits the variants ei and vx.

The feature(?) and the bug are in ex/vi 3.7 as well, which comes with 4.2BSD.

> The bug was discovered by trying to install a user with the initials 'jei'
> into /etc/passwd.

The fact that mode-line processing can't be turned off is, arguably, a bug
(the same thing may have bitten us here; "vi" acted strangely when editing
/etc/passwd, and I think there was an entry that looked like a mode line).
Somebody posted some changes to "ex" (which apply both the 4.2BSD's 3.7 and
System V Release 2's 3.9) which added a flag "modelines" which, when on,
enabled mode-line processing; the default was to disable mode-line
processing.

	Guy Harris

honey@down.FUN (Peter Honeyman) (05/28/85)

the fact that the modelines search is for the pattern [ev][xi]: rather
than for (ex|vi): aggravates the problem.
	peter