From frank@exit.com Thu Aug 26 08:30:47 1999
Return-Path: <frank@exit.com>
Received: from exit.com (exit-gw.power.net [207.151.46.196])
	by hub.freebsd.org (Postfix) with ESMTP id 6E77314DC5
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 26 Aug 1999 08:30:45 -0700 (PDT)
	(envelope-from frank@exit.com)
Received: from realtime.exit.com (realtime.exit.com [206.223.0.5])
	by exit.com (8.9.3/8.9.3) with ESMTP id IAA52803
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 26 Aug 1999 08:30:04 -0700 (PDT)
	(envelope-from frank@exit.com)
Received: (from frank@localhost)
	by realtime.exit.com (8.9.3/8.9.1) id IAA18219;
	Thu, 26 Aug 1999 08:30:04 -0700 (PDT)
	(envelope-from frank)
Message-Id: <199908261530.IAA18219@realtime.exit.com>
Date: Thu, 26 Aug 1999 08:30:04 -0700 (PDT)
From: Frank.Mayhar@exit.com
Sender: frank@exit.com
Reply-To: frank@exit.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: vi can mishandle tags files.
X-Send-Pr-Version: 3.2

>Number:         13397
>Category:       bin
>Synopsis:       vi(1) nvi mishandles tags files under certain conditions.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 26 08:40:01 PDT 1999
>Closed-Date:    
>Last-Modified:  Sat Nov  2 09:20:04 UTC 2013
>Originator:     Frank Mayhar
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
exit.com
>Environment:

	3.2-stable.

>Description:

	The code in ex/ex_tag.c replaces the / it just removed before it
	stats the directory; it should wait until after it does the stat.

>How-To-Repeat:

	Honestly, I don't remember.  I think it has to do with multiple
	tags files, but it's a real bug.

>Fix:
	
	Here's a patch:

Index: ex_tag.c
===================================================================
RCS file: /cvs/repos/src/contrib/nvi/ex/ex_tag.c,v
retrieving revision 1.2
diff -c -r1.2 ex_tag.c
*** ex_tag.c	1997/04/18 23:36:43	1.2
--- ex_tag.c	1999/06/25 20:59:29
***************
*** 1339,1349 ****
  	    stat(name, &sb) && (p = strrchr(tfp->name, '/')) != NULL) {
  		*p = '\0';
  		len = snprintf(buf, sizeof(buf), "%s/%s", tfp->name, name);
- 		*p = '/';
  		if (stat(buf, &sb) == 0) {
  			*dirp = tfp->name;
  			*dlenp = strlen(*dirp);
  		}
  	}
  }
  
--- 1339,1349 ----
  	    stat(name, &sb) && (p = strrchr(tfp->name, '/')) != NULL) {
  		*p = '\0';
  		len = snprintf(buf, sizeof(buf), "%s/%s", tfp->name, name);
  		if (stat(buf, &sb) == 0) {
  			*dirp = tfp->name;
  			*dlenp = strlen(*dirp);
  		}
+ 		*p = '/';
  	}
  }
  

>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: frank@exit.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/13397: vi can mishandle tags files. 
Date: Thu, 26 Aug 1999 18:02:40 +0200

 Have you raised this issue with the maintainer of nvi,
 Keith Bostic <bostic@bostic.com> ?
 
 Ciao,
 Sheldon.
 

From: Frank Mayhar <frank@exit.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/13397: nvi mishandles tags files under certain conditions.
Date: Sun, 17 Jun 2001 09:37:06 -0700

 I did raise this issue with Keith Bostic, who said that he would
 fix it "when he got around to it."  That was, oh, over a year ago?
 The last time I talked to Keith was at BSDCon in October, 2000 and
 it was still on his list of things to do.

From: Mike Heffner <mheffner@novacoxmail.com>
To: Frank Mayhar <frank@exit.com>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/13397: nvi mishandles tags files under certain condition
Date: Sun, 17 Jun 2001 14:23:20 -0400 (EDT)

 On 17-Jun-2001 Frank Mayhar wrote:
 | The following reply was made to PR bin/13397; it has been noted by GNATS.
 | 
 | From: Frank Mayhar <frank@exit.com>
 | To: freebsd-gnats-submit@FreeBSD.org
 | Cc:  
 | Subject: Re: bin/13397: nvi mishandles tags files under certain conditions.
 | Date: Sun, 17 Jun 2001 09:37:06 -0700
 | 
 |  I did raise this issue with Keith Bostic, who said that he would
 |  fix it "when he got around to it."  That was, oh, over a year ago?
 |  The last time I talked to Keith was at BSDCon in October, 2000 and
 |  it was still on his list of things to do.
 
 
 It appears to be fixed in 1.81.3, probably from:
 
 -----------------------------------------------------
 skimo  Thu Jun 29 12:41:52 PDT 2000
 
 Modified Files:
         ex/ex_tag.c
 Log Message:
 ctags fix
 
 
 The website says they're planning a release for the fall.
 
 
 Mike
 
 -- 
   Mike Heffner               <mheffner@vt.edu>
   Fredericksburg, VA       <mikeh@FreeBSD.org>
       http://filebox.vt.edu/users/mheffner
 

From: Zhihao Yuan <zy@miator.net>
To: bug-followup@FreeBSD.org, frank@exit.com
Cc:  
Subject: Re: bin/13397: vi(1) nvi mishandles tags files under certain
 conditions.
Date: Sat, 2 Nov 2013 05:13:32 -0400

 Fixed in CURRENT.
 
 -- 
 Zhihao Yuan, ID lichray
 The best way to predict the future is to invent it.
 ___________________________________________________
 4BSD -- http://4bsd.biz/
>Unformatted:
