From nobody@FreeBSD.org  Thu Dec 28 13:17:26 2000
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 0029D37B404
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 28 Dec 2000 13:17:20 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id eBSLHKp32802;
	Thu, 28 Dec 2000 13:17:20 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200012282117.eBSLHKp32802@freefall.freebsd.org>
Date: Thu, 28 Dec 2000 13:17:20 -0800 (PST)
From: gladiatr@boneyard.lawrence.ks.us
Sender: nobody@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: underflow of cnt in vs_paint() by O_NUMBER_LENGTH when both leftright and number options in use
X-Send-Pr-Version: www-1.0

>Number:         23912
>Category:       bin
>Synopsis:       vi(1) underflow of cnt in vs_paint() by O_NUMBER_LENGTH when both leftright and number options in use
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          analyzed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 28 13:20:01 PST 2000
>Closed-Date:    
>Last-Modified:  Mon Dec  9 18:50:00 UTC 2013
>Originator:     Stephen D. Spencer
>Release:        4.2
>Organization:
>Environment:
FreeBSD gandhi.eecs.ukans.edu 4.2-STABLE FreeBSD 4.2-STABLE #0: Mon Dec 18 09:41:03 CST 2000     sdspence@gandhi.eecs.ukans.edu:/usr/src/sys/compile/gandhi  i386

>Description:
in versions of nvi including the newer development versions, if the
leftright and number options are both active, the editor will dive into
a not-quite-inifinite loop.  in several seconds, it will return.  if 
the ruler option is active, it shows (1,4294967288).  nvi remains
fairly useless from this point forward and must be sigkill'd
>How-To-Repeat:
vi /your/favorite/file that is long enough to require a page redraw
: set leftright
: set number

<Ctrl>F a few times... (croak)

>Fix:
this problem was traced back to vs_columns() returning a 0 value 
regardless of whether or not the number option is being used.

according to vi/vi.h, #define O_NUMBER_LENGTH 8

which should be the offset returned when 'set number' is active so 
that when the O_NUMBER_LENGH margin used for displaying the line number
is subtracted from the literal screen column, you will end up with 
column '0' rather than 0xFFFFFFF8.

Please note, I have read the comments towards the last nvi bug report
that was submitted here and understand that nothing will be 
done until the vendor commits the patch to their distribution.  I
thought it would be nice in case someone else has tried these two 
options in tandem and not had time to poke around to at least have a 
manual recourse.

I have submitted a bug report to Keith Bostic.  They are in the middle
of getting ready for a DB rollout, so it will be a while before he is
able to review the report.

--- vs_relative.c.orig  Mon May 13 09:20:04 1996
+++ vs_relative.c       Thu Dec 28 00:54:32 2000
@@ -122,7 +122,7 @@
        if (lp == NULL) {
 done:          if (diffp != NULL)              /* XXX */
                        *diffp = 0;
-               return (0);
+               return (O_ISSET(sp, O_NUMBER) ? O_NUMBER_LENGTH : 0);
        }
 
        /* Store away the values of the list and leftright edit options. */


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sun Nov 18 11:45:08 PST 2001 
State-Changed-Why:  

Does this problem still occur? I haven't been able to reproduce it. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=23912 

From: Stephen Spencer <gladiatr@boneyard.lawrence.ks.us>
To: freebsd-gnats-submit@FreeBSD.org,
	gladiatr@boneyard.lawrence.ks.us
Cc:  
Subject: Re: bin/23912: underflow of cnt in vs_paint() by O_NUMBER_LENGTH when both leftright and number options in use
Date: Thu, 20 Dec 2001 10:46:51 -0600

 Sorry if this is a repeat, but my previous follow-ups never made it into 
 the PR:
 
  > Does this problem still occur? I haven't been able to reproduce it.
 
 The answer to this is that it does indeed still exist.
 
 Line 125 of contrib/nvi/vi/vs_relative.c is still doing the wrong thing.
 
 
State-Changed-From-To: feedback->open 
State-Changed-By: sheldonh 
State-Changed-When: Sun Dec 30 06:38:51 PST 2001 
State-Changed-Why:  
Originator says the problem still exists. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=23912 

From: Sheldon Hearn <sheldonh@starjuice.net>
To: Stephen Spencer <gladiatr@boneyard.lawrence.ks.us>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/23912: underflow of cnt in vs_paint() by O_NUMBER_LENGTH when both leftright and number options in use 
Date: Sun, 30 Dec 2001 16:42:39 +0200

 On Thu, 20 Dec 2001 08:50:02 PST, Stephen Spencer wrote:
 
 >  Sorry if this is a repeat, but my previous follow-ups never made it into 
 >  the PR:
 >  
 >   > Does this problem still occur? I haven't been able to reproduce it.
 >  
 >  The answer to this is that it does indeed still exist.
 >  
 >  Line 125 of contrib/nvi/vi/vs_relative.c is still doing the wrong thing.
 
 Has Keith had time to review your report yet?
 
 Ciao,
 Sheldon.

From: "Stephen D. Spencer" <gladiatr@boneyard.lawrence.ks.us>
To: Sheldon Hearn <sheldonh@starjuice.net>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/23912: underflow of cnt in vs_paint() by O_NUMBER_LENGTH
 when both leftright and number options in use 
Date: Sun, 30 Dec 2001 14:31:35 -0600 (CST)

 On Sun, 30 Dec 2001, Sheldon Hearn wrote:
 
 > On Thu, 20 Dec 2001 08:50:02 PST, Stephen Spencer wrote:
 > 
 > >  Sorry if this is a repeat, but my previous follow-ups never made it into 
 > >  the PR:
 > >  
 > >   > Does this problem still occur? I haven't been able to reproduce it.
 > >  
 > >  The answer to this is that it does indeed still exist.
 > >  
 > >  Line 125 of contrib/nvi/vi/vs_relative.c is still doing the wrong thing.
 > 
 > Has Keith had time to review your report yet?
 > 
 
 I haven't heard back yet.  Perhaps I should resubmit the bug report.  It still
 has not been fixed in the newer, development versions either.
 
 Stephen Spencer | 
                 |  "Come down off the cross. 
                 |    We can use the wood..." 
                 |                                T. Waits 
 
 

From: Sheldon Hearn <sheldonh@starjuice.net>
To: "Stephen D. Spencer" <gladiatr@boneyard.lawrence.ks.us>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/23912: underflow of cnt in vs_paint() by O_NUMBER_LENGTH when both leftright and number options in use 
Date: Mon, 31 Dec 2001 11:09:41 +0200

 On Sun, 30 Dec 2001 14:31:35 CST, "Stephen D. Spencer" wrote:
 
 > > Has Keith had time to review your report yet?
 > > 
 > 
 > I haven't heard back yet.  Perhaps I should resubmit the bug report.  It still
 > has not been fixed in the newer, development versions either.
 
 All we really need from keith is a "yes, we'll adopt your patch
 verbatim" and we can commit it.
 
 Ciao,
 Sheldon.
State-Changed-From-To: open->analyzed 
State-Changed-By: sheldonh 
State-Changed-When: Mon Jan 7 06:06:56 PST 2002 
State-Changed-Why:  
I'll commit the vendor-approved patch as soon as I have word back 
from <cvs@FreeBSD.org> on the best way to do this. 


Responsible-Changed-From-To: freebsd-bugs->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Jan 7 06:06:56 PST 2002 
Responsible-Changed-Why:  
I'll take this one. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=23912 

From: Mike Heffner <mheffner@novacoxmail.com>
To: freebsd-gnats-submit@freebsd.org
Cc: FreeBSD-bugs <freebsd-bugs@freebsd.org>
Subject: Re: bin/23912: underflow of cnt in vs_paint() by O_NUMBER_LENGTH when both leftright and number options in u
Date: Mon, 07 Jan 2002 16:47:17 -0500 (EST)

 For audit-trail:
 
 Please see PR 33648 for followup.
 
 Mike
 
 -- 
   Mike Heffner     <mheffner@[acm.]vt.edu>
   Fredericksburg, VA   <mikeh@FreeBSD.org>
 
Responsible-Changed-From-To: sheldonh->freebsd-bugs 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Feb 17 03:19:07 PST 2004 
Responsible-Changed-Why:  
Release. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=3170 
Responsible-Changed-From-To: sheldonh->freebsd-bugs 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Feb 17 03:19:07 PST 2004 
Responsible-Changed-Why:  
Release. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=26869 
Responsible-Changed-From-To: sheldonh->freebsd-bugs 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Feb 17 03:19:07 PST 2004 
Responsible-Changed-Why:  
Release. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=33672 
Responsible-Changed-From-To: sheldonh->freebsd-bugs 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Feb 17 03:19:07 PST 2004 
Responsible-Changed-Why:  
Release. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=23912 

From: Zhihao Yuan <zhihao.yuan@rackspace.com>
To: bug-followup@FreeBSD.org, gladiatr@boneyard.lawrence.ks.us
Cc:  
Subject: Re: bin/23912: vi(1) underflow of cnt in vs_paint() by
 O_NUMBER_LENGTH when both leftright and number options in use
Date: Mon, 9 Dec 2013 13:44:10 -0500

 Fixed long long time ago; please close.
 
 -- 
 Zhihao Yuan <zhihao.yuan@rackspace.com>
 The best way to predict the future is to invent it.
 ___________________________________________________
 4BSD -- http://4bsd.biz/
>Unformatted:
