Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jan 2004 11:43:17 -0600 (CST)
From:      Jason Bacon <bacon@smithers.neuro.mcw.edu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/60944: "file" identifies text files as "character Computer Graphics Metafile"
Message-ID:  <200401051743.i05HhHKd051240@smithers.neuro.mcw.edu>
Resent-Message-ID: <200401051750.i05HoDSw008701@freefall.freebsd.org>

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

>Number:         60944
>Category:       bin
>Synopsis:       "file" identifies text files as "character Computer Graphics Metafile"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 05 09:50:13 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Jason Bacon
>Release:        FreeBSD 5.1-RELEASE i386
>Organization:
Medical College of Wisconsin
>Environment:
System: FreeBSD smithers.neuro.mcw.edu 5.1-RELEASE FreeBSD 5.1-RELEASE #0: Mon Dec 29 11:34:44 CST 2003 bacon@smithers.neuro.mcw.edu:/usr/obj/usr/src/sys/smithers i386


>Description:
	The "file" command incorrectly identifies certain text files
	as "character Computer Graphics Metafile".  This occurs if the
	the file begins with the character `0' (hex 30) in byte 0 of the
	file, followed by a space (hex 20) in byte 1, which satisfies 
	the magic number test 

	0       beshort   0x3020   character Computer Graphics Metafile

	in /usr/share/misc/magic.  This problem subsequently affects apsfilter,
	which uses "file" to identify the file type, and hence disrupts 
	printing of these text files using "lpr".

>How-To-Repeat:
	Run "file" on any text file with a `0' in the first byte and
	a space in the second.

>Fix:
	Workaround: Insert whitespace (or anything else suitable for the
	type of text file you have) before the first `0' of all your ascii
	data files in order to shift it forward from byte 0 in the file,
	and cause the above magic test to fail.

	Fix: Since ascii data files beginning with a `0' are common,
	this magic number test is risky and probably inappropriate, 
	and should probably be removed from /usr/share/misc/magic.
	Of course, this will disable "file" from identifying a 
	"character Computer Graphics Metafile".
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401051743.i05HhHKd051240>