Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 1999 08:30:04 -0700 (PDT)
From:      Frank.Mayhar@exit.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/13397: vi can mishandle tags files.
Message-ID:  <199908261530.IAA18219@realtime.exit.com>

next in thread | raw e-mail | index | archive | help

>Number:         13397
>Category:       bin
>Synopsis:       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:
>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:
>Unformatted:


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?199908261530.IAA18219>