*BSD News Article 41381


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.hawaii.edu!ames!night.primate.wisc.edu!nntp.msstate.edu!olivea!news.hal.COM!darkstar.UCSC.EDU!cats.ucsc.edu!haynes
From: haynes@cats.ucsc.edu (James H. Haynes)
Newsgroups: comp.unix.bsd
Subject: Obscure (to me, at least) bug in vi
Date: 14 Jan 1995 01:39:00 GMT
Organization: University of California, Santa Cruz
Lines: 32
Message-ID: <3f79vk$5c@darkstar.UCSC.EDU>
NNTP-Posting-Host: hobbes.ucsc.edu


I have a user who gets into those dark, cobwebby corners of vi.  Here's a bug
he reported to me.

Make a .exrc file containing the line
    map _ /-$(esc)JxX
where (esc) is the escape character.

Make a test file containing the likes of

aaaa-
aaaaa
bbb-
bbbbbb

and edit it.  The thing in the .exrc file maps the underbar character to be
an end-of-line-hyphen remover.  You'll see that it works.

Now try   S    to substitute something for the whole line.  You'll find on
some versions of vi that the characters in the macro get stuck into the
line you are editing; specifically it will contain JxX-  before you type
anything further.

I've tried this on an old VAX running 4.3BSD, a newer MicroVax running
some version of Ultrix, an ISI machine, and a Sparc running SunOS 4.1.3_U1.
So it seems to be something that came in the BSD code base.

I've also tried it on elvis running on Linux and NetBSD, and also on
Keith Bostic's  nvi   and they all do the right thing; they don't
insert JxX- when you use the S command.

Or is the user doing something wrong?