From mi@corbulon.video-collage.com  Thu Mar  6 12:23:23 2003
Return-Path: <mi@corbulon.video-collage.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 8F29337B401; Thu,  6 Mar 2003 12:23:23 -0800 (PST)
Received: from corbulon.video-collage.com (corbulon.video-collage.com [64.35.99.179])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 74FBC43F75; Thu,  6 Mar 2003 12:23:22 -0800 (PST)
	(envelope-from mi@corbulon.video-collage.com)
Received: from corbulon.video-collage.com (mi@localhost.video-collage.com [127.0.0.1])
	by corbulon.video-collage.com (8.12.8/8.12.8) with ESMTP id h26KNJIN047415
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO);
	Thu, 6 Mar 2003 15:23:20 -0500 (EST)
	(envelope-from mi@corbulon.video-collage.com)
Received: (from mi@localhost)
	by corbulon.video-collage.com (8.12.8/8.12.8/Submit) id h26KNJIu047162;
	Thu, 6 Mar 2003 15:23:19 -0500 (EST)
	(envelope-from mi)
Message-Id: <200303062023.h26KNJIu047162@corbulon.video-collage.com>
Date: Thu, 6 Mar 2003 15:23:19 -0500 (EST)
From: Mikhail Teterin <mi@aldan.algebra.com>
Reply-To: Mikhail Teterin <mi@aldan.algebra.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: petef@freebsd.org
Subject: make file(1)/magic(5) recognize cscope referenece files
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         48983
>Category:       bin
>Synopsis:       make file(1)/magic(5) recognize cscope referenece files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 06 12:30:13 PST 2003
>Closed-Date:    Fri Mar 07 07:14:01 PST 2003
>Last-Modified:  Fri Mar 07 07:14:01 PST 2003
>Originator:     Mikhail Teterin
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Virtual Estates, Inc.
>Environment:
System: FreeBSD mi.us.murex.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Fri Feb 28 13:11:26 EST 2003 mteterin@mi.us.murex.com:/misha/obj/misha/src/sys/Misha-g i386

>Description:
	The cscope's reference files (usually named "cscope.out") are not
	recognized as anything but "data".

>How-To-Repeat:

>Fix:

The file begins with
	"cscope <version> <directory>[ -c][ -q]

The <version> is -- so far -- a two-digit number, but <directory> is of
arbitrary length and file(1) truncates strings to 32 characters anyway.
So we skip it.

`` -c'' means the file is non-compressed (non-binary) and is human
readable.

The following can be added to whatever place appropriate among the
magic(5)'s components:

	0	string	cscope	cscope reference data
	>7	string	x	version %.2s
	# We skip the path here, because it is often long (so file will
	# truncate it) and mostly redundant.
	# The inverted index functionality was added some time betwen
	# versions 11 and 15, so look for -q if version is above 14:
	>7	string	>14
	>>10	regex	.+\ -q\	with inverted index
	>10	regex	.+\ -c\	text (non-compressed)

It has the following drawbacks however:

	1) relies on the undocumented "regex" type -- more of a problem with magic's
	   man page, perhaps;
	2) deems such files as "data", even if they are marked with ``-c'', which
	   makes them textual.

The first can be addressed (if needed) by simply leaving only the first
two lines (forget the -q and -c). The second needs someone better
skilled with regular expressions -- if -c is not found say: "data", if
it is present -- say: "text", but never both.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: roam 
State-Changed-When: Thu Mar 6 23:32:55 PST 2003 
State-Changed-Why:  
Err.. shouldn't this be submitted directly to Christos Zoulas 
<christos@zoulas.com>, as noted in src/contrib/file/FREEBSD-upgrade 
and in quite a lot of other file(1)-related PR's? :) 

Could you get in touch with Christos and ask him to make the relevant 
changes in the mainstream file(1) distribution, so that it could make 
its way into FreeBSD at the next vendor import? 

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

From: Mikhail Teterin <mi+kde@aldan.algebra.com>
To: christos@zoulas.com
Cc: freebsd-gnats-submit@FreeBSD.org, roam@FreeBSD.org
Subject: Re: bin/48983: make file(1)/magic(5) recognize cscope referenece files
Date: Fri, 7 Mar 2003 09:27:50 -0500

 Hello!
 
 I submitted the following addition to FreeBSD, but was kindly
 pointed into your direction. Thanks for your time! Yours,
 
 	-mi
 
 	http://www.freebsd.org/cgi/query-pr.cgi?pr=48983
 

From: christos@zoulas.com (Christos Zoulas)
To: Mikhail Teterin <mi+kde@aldan.algebra.com>
Cc: freebsd-gnats-submit@FreeBSD.org, roam@FreeBSD.org
Subject: Re: bin/48983: make file(1)/magic(5) recognize cscope referenece files
Date: Fri, 7 Mar 2003 09:59:32 -0500

 On Mar 7,  9:27am, mi+kde@aldan.algebra.com (Mikhail Teterin) wrote:
 -- Subject: Re: bin/48983: make file(1)/magic(5) recognize cscope referenece 
 
 Thanks, I've added it.
 
 christos
 
 | Hello!
 | 
 | I submitted the following addition to FreeBSD, but was kindly
 | pointed into your direction. Thanks for your time! Yours,
 | 
 | 	-mi
 | 
 | 	http://www.freebsd.org/cgi/query-pr.cgi?pr=48983
 -- End of excerpt from Mikhail Teterin
 
 
State-Changed-From-To: feedback->closed 
State-Changed-By: roam 
State-Changed-When: Fri Mar 7 07:12:21 PST 2003 
State-Changed-Why:  
Christos indicated that he had added the cscope definitions to 
the file(1) main distribution's database.  Thus, they will show 
up in FreeBSD with the next src/contrib/file vendor import. 

Thanks for the enhancement and the communication with Christos! 

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