From ak03@gte.com  Mon Oct  2 12:25:42 2000
Return-Path: <ak03@gte.com>
Received: from h132-197-97-45.gte.com (h132-197-97-45.gte.com [132.197.97.45])
	by hub.freebsd.org (Postfix) with ESMTP id 6061937B502
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  2 Oct 2000 12:25:41 -0700 (PDT)
Received: (from ak03@localhost)
	by h132-197-97-45.gte.com (8.11.0/8.11.0) id e92JPeA19141;
	Mon, 2 Oct 2000 15:25:40 -0400 (EDT)
	(envelope-from ak03)
Message-Id: <200010021925.e92JPeA19141@h132-197-97-45.gte.com>
Date: Mon, 2 Oct 2000 15:25:40 -0400 (EDT)
From: ak03@gte.com
Reply-To: ak03@gte.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: CSCOPE writes incorrect offset into index file
X-Send-Pr-Version: 3.2

>Number:         21705
>Category:       ports
>Synopsis:       CSCOPE writes incorrect offset into index file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 02 12:30:01 PDT 2000
>Closed-Date:    Sun Feb 25 19:45:17 PST 2001
>Last-Modified:  Sun Feb 25 19:45:40 PST 2001
>Originator:     Alexander Kabaev
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:

Ports tree cvsupped on Oct 2 2000,
FreeBSD 5.0-CURRENT (not relevant)

>Description:

Due to the fact, that FreeBSD fputs does not return exact number of
bytes written, wrong value for 'tailerofset' is getting written into
the cross-reference file. That makes it impossible to reuse index file
when running cscope under cbrowser control, for instance. Cbrowser 
runs cscope with the command which looks like:

 cscope -dl -f cscope.out

where -d instructs cscope not to rebuild index file and assume it
is up-to-date. While trying to reopen pre-existing data file
cscope seeks at incorrect offset and then fails with an error 
message.

>How-To-Repeat:

Run cscope with above command line and watch it fail.
	
>Fix:
 Add attached file to the patches directory.

--- src/constants.h.orig	Mon Oct  2 14:36:07 2000
+++ src/constants.h	Mon Oct  2 14:37:09 2000
@@ -43,7 +43,7 @@
 
 /* database output macros that update its offset */
 #define	dbputc(c)	(++dboffset, (void) putc(c, newrefs))
-#if Linux || BSD && !sun
+#if Linux || __FreeBSD__ || BSD && !sun
 #define	dbfputs(s)	(dboffset += strlen(s), fputs(s, newrefs))
 #else
 #define	dbfputs(s)	(dboffset += fputs(s, newrefs))

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Sun Feb 25 19:45:17 PST 2001 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21705 
>Unformatted:
