Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2001 23:59:12 -0400 (EDT)
From:      Mike Heffner <mheffner@novacoxmail.com>
To:        freebsd-gnats-submit@freebsd.org
Cc:        FreeBSD-bugs <freebsd-bugs@freebsd.org>
Subject:   FW: Re: bin/12801: nvi infinite recursion with options "leftrigh
Message-ID:  <XFMail.20010814235912.mheffner@novacoxmail.com>

next in thread | raw e-mail | index | archive | help
This message is in MIME format
--_=XFMail.1.5.0.FreeBSD:20010814235912:291=_
Content-Type: multipart/mixed;
 boundary="_=XFMail.1.5.0.FreeBSD:20010814235912:291=_"

This message is in MIME format
--_=XFMail.1.5.0.FreeBSD:20010814235912:291=_
Content-Type: text/plain; charset=us-ascii

Forwarding to audit-trail.

-----FW: <20010814234350.A52363@unknown.whichever.org>-----

Date: Tue, 14 Aug 2001 23:43:50 -0400
From: Alexander Litvin <archer@whichever.org>
To: Sheldon Hearn <sheldonh@starjuice.net>
Subject: Re: bin/12801: nvi infinite recursion with options "leftright" and
"comment"
Cc: mikeh@FreeBSD.org

> In message about "Re: bin/12801: nvi infinite recursion with options
"leftright" and "comment""
>  on Fri, Jul 06, 2001, at 08:48:09 AM you wrote:
> 
> > > Synopsis: nvi infinite recursion with options "leftright" and "comment"
> > > 
> > > State-Changed-From-To: suspended->feedback
> > > State-Changed-By: mikeh
> > > State-Changed-When: Thu Jul 5 17:26:35 PDT 2001
> > > State-Changed-Why: 
> > > Is this fixed with the patch in bin/28687?
> > 
> > Should be. :-)
> 
> No, unfortunately it's not.

Actually, as I investigated the problem, it is more severe
then just using to incompatible options. That is, this
infinite recursion can be "achieved" even without "comment"
option -- it is enougth, for example, to do the following:

1) go to the line with number NUM, where
   1 < NUM < "screen height"/2;
2) make the line to be on the top of the screen
   (e.g. by z+<Enter>);
3) do :e <non-existent file>

What I figured is that during switching files vi somehow
messes up the old and new state -- like sp (pointer to
screen structure?) already contains (mostly) info about
new file, but HMAP macro (what's this exactly?) still
has information about old file position. The fact that
this mess really works through vs_refresh() is, IMHO,
accidential.

The attached patch seems to fix the problem. This is sort
of hack, because I don't exactly understand the guts of vi,
and I have no idea how produce politically correct fix.
But at least it doesn't do anything bad (IMHO).

--- 
Laugh at your problems; everybody else does.


--------------End of forwarded message-------------------------


Mike

-- 
  Mike Heffner         <mheffner@[acm.]vt.edu>
  Fredericksburg, VA       <mikeh@FreeBSD.org>


--_=XFMail.1.5.0.FreeBSD:20010814235912:291=_
Content-type: text/plain; NAME=vi.diff; charset=us-ascii
Content-disposition: attachment; filename=vi.diff

*** src/contrib/nvi/vi/vi.c.orig	Tue Aug 14 23:13:30 2001
--- src/contrib/nvi/vi/vi.c	Tue Aug 14 23:14:34 2001
***************
*** 399,404 ****
--- 399,408 ----
  		if (F_ISSET(sp, SC_FSWITCH)) {
  			F_CLR(sp, SC_FSWITCH);
  			(void)sp->gp->scr_rename(sp, sp->frp->name, 1);
+ 			/* XXX */
+ 			HMAP->lno = sp->lno;
+ 			HMAP->coff = 0;
+ 			HMAP->soff = 1;
  		}
  
  		/* If leaving vi, return to the main editor loop. */

--_=XFMail.1.5.0.FreeBSD:20010814235912:291=_--
End of MIME message

--_=XFMail.1.5.0.FreeBSD:20010814235912:291=_
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE7efOQFokZQs3sv5kRAuvuAJ0UDhHUc1UbDWNkv4CiscRvCeG8WwCcCGhB
LwuMb75VTX/Indma8/kN6Ys=
=0qy3
-----END PGP SIGNATURE-----

--_=XFMail.1.5.0.FreeBSD:20010814235912:291=_--
End of MIME message

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20010814235912.mheffner>