Subject: bin/36084: ambiguous file(1) "magic" mis-identifies files
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <timshel@shels.net>
List: netbsd-bugs
Date: 03/25/2007 16:20:00
>Number:         36084
>Category:       bin
>Synopsis:       ambiguous file(1) "magic" mis-identifies files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 25 16:20:00 +0000 2007
>Originator:     Timshel Knoll-Miller
>Release:        NetBSD 3.1
>Organization:
Shels.net
>Environment:
System: NetBSD treebeard.shels.local 3.1 NetBSD 3.1 (GENERIC) #0: Tue Oct 31 04:27:07 UTC 2006 builds@b0.netbsd.org:/home/builds/ab/netbsd-3-1-RELEASE/i386/200610302053Z-obj/home/builds/ab/netbsd-3-1-RELEASE/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386

>Description:
	file(1)'s magic database contains ambiguous entries which
	erroneously identify general text files as more other complex
	file types

	The specific problem I am experiencing is with a file from
	pkgsrc/net/proftpd from pkgsrc-2006Q4; specifically
	${WRKSRC}/contrib/mod_wrap.c. This file contains the word
	"library" beginning at file offset 60, which matches the
	file(1) magic from src/dist/file/magic/magdir/palm:

# Palm OS .prc file types       
60              string          libr            Palm OS dynamic library data
>0              string          >\0             "%s"

	
	The magic number is clearly not specific enough.
	The net affect of this problem for me is that I cannot use
	pkgsrc's subst.mk on the affected file without a very ugly
	workaround to this problem.

>How-To-Repeat:
	Run "make extract" in pkgsrc/net/proftpd (pkgsrc-2006Q4) and run
	"file work/proftpd-1.3.1rc2/contrib/mod_wrap.c":

me@myhost ttyp1 proftpd-1.3.1rc2]$ file contrib/mod_wrap.c
contrib/mod_wrap.c: Palm OS dynamic library data "/*"

>Fix:
Remove (or improve) the magic around Palm OS dynamic library data (and
potentially other ambiguous entries?)