Bug 60944

Summary: "file" identifies text files as "character Computer Graphics Metafile"
Product: Base System Reporter: Jason Bacon <bacon>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.1-RELEASE   
Hardware: Any   
OS: Any   

Description Jason Bacon 2004-01-05 17:50:13 UTC
	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".

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".
How-To-Repeat: 	Run "file" on any text file with a `0' in the first byte and
	a space in the second.
Comment 1 Kris Kennaway freebsd_committer freebsd_triage 2004-01-09 17:04:16 UTC
State Changed
From-To: open->closed

FreeBSD does not maintain the third-party file(1) software. 
Please file this bug report with the authors instead.