From owner-freebsd-bugs Thu Mar 6 12:30:18 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A6F7837B401 for ; Thu, 6 Mar 2003 12:30:15 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CCE043FAF for ; Thu, 6 Mar 2003 12:30:14 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h26KUENS017223 for ; Thu, 6 Mar 2003 12:30:14 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h26KUEsO017222; Thu, 6 Mar 2003 12:30:14 -0800 (PST) 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 Reply-To: Mikhail Teterin To: FreeBSD-gnats-submit@FreeBSD.org Cc: petef@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/48983: make file(1)/magic(5) recognize cscope referenece files Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Mar 06 12:30:13 PST 2003 >Closed-Date: >Last-Modified: >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 [ -c][ -q] The is -- so far -- a two-digit number, but 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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message