| Summary: | [patch] nvi(1) infinite recursion with options "leftright" and "comment" | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Alexander Litvin <archer> | ||||||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||||||
| Status: | Closed FIXED | ||||||||||
| Severity: | Affects Only Me | CC: | emaste | ||||||||
| Priority: | Normal | ||||||||||
| Version: | 4.0-CURRENT | ||||||||||
| Hardware: | Any | ||||||||||
| OS: | Any | ||||||||||
| Attachments: |
|
||||||||||
> The simultanious usage of the vi editor options 'comment' (skip leading
> comments) and 'leftright' (do left-right scrolling) may lead to the
> infinite recursion: on src/contrib/nvi/vi/vs_refresh.c:626 vs_paint()
In the current sources, it's line 696. We're failing a sanity check,
which causes an abort(3) if the program is compiled with -DDEBUG.
Your How-To-Repeat is solid. I'll take a look.
Ciao,
Sheldon.
State Changed From-To: open->suspended Since nvi is in the contrib tree, I've mailed the author with a detailed description of the problem. Suspended just means its not feasible for FreeBSD developers to be looking at the problem right now. If Keith determines that this is a vnedor-specific problem, I'll change the state. Responsible Changed From-To: freebsd-bugs->sheldonh This one's on my list. State Changed From-To: suspended->feedback Is this fixed with the patch in bin/28687? State Changed From-To: feedback->open Submitter reports this problem is not fixed with patch for bin/12801. > 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.
This message is in MIME format Responsible Changed From-To: sheldonh->freebsd-bugs I don't have time to get stuck into this one again. Anyway, people seem to have declared open season on the vendor branch for nvi and there are even rumours of an impending new release. Again. ;-) Fixed by https://github.com/lichray/nvi2/commit/3c7a9a74038f593ab4a437cfe8f791092a796b1e ; will be imported latter. -- Zhihao Yuan, ID lichray The best way to predict the future is to invent it. ___________________________________________________ 4BSD -- http://4bsd.biz/ Looks like fix was imported in r257999. |
The simultanious usage of the vi editor options 'comment' (skip leading comments) and 'leftright' (do left-right scrolling) may lead to the infinite recursion: on src/contrib/nvi/vi/vs_refresh.c:626 vs_paint() function called recursively from itself. The result is that stack is exhausted and process receives segfault. Fix: The workaround is obviously not use 'comment' and 'leftright' options simultaniously. How-To-Repeat: 1. Create the ${HOME}/.exrc file with two lines: set leftright set comment or, add these lines to the existing .exrc; 2. Open any file with a few shell, C or C++ comment lines in the beginning; 3. Try to open any non-existent (new) file from the same editing session by invoking ex "edit" command.