Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Aug 2001 10:23:01 -0700
From:      Mark Peek <mark@whistle.com>
To:        Peter Pentchev <roam@ringlet.net>
Cc:        audit@FreeBSD.ORG
Subject:   Re: [PATCH] fix a file(1) minor POLA stretching
Message-ID:  <p0510030bb795ce34d864@[207.76.207.129]>
In-Reply-To: <20010806055759.E586@ringworld.oblivion.bg>
References:  <20010806055759.E586@ringworld.oblivion.bg>

next in thread | previous in thread | raw e-mail | index | archive | help
At 5:57 AM +0300 8/6/01, Peter Pentchev wrote:
>It seems that the new file(1), recently imported into -current and
>-stable, has a slightly changed behavior, which results in a minor
>POLA stretching (maybe not really a violation).
>
>This new version of file(1) can "compile" magic files into a new,
>binary database-like format.  Whenever the file(1) utility is invoked
>to examine a file, it first tries to open this new binary magic db,
>and not finding it, falls back to the old, regular magic file.
>This results in a warning message sent to stderr for each and every
>invocation of file(1) :)
>
>The fix is simple: build and install the new magic database along
>with the old file.  Patch attached.

Peter,
Is this "binary" format portable? At first glance I think your patch would
break cross compilation. Here's a patch that should fix this by building the database at install time instead of during the compilation phase.

Mark

http://people.freebsd.org/~mp/file.patch

Index: Makefile
===================================================================
RCS file: /cvs/freebsd/src/usr.bin/file/Makefile,v
retrieving revision 1.18
diff -u -r1.18 Makefile
--- Makefile	2001/07/30 03:50:04	1.18
+++ Makefile	2001/08/07 17:11:47
@@ -25,6 +25,7 @@
 # Hacked and dismembered for bmake (Geoff Rehmet).
 
 MAGICFILE=	/usr/share/misc/magic
+MAGICDB=	${MAGICFILE}.mgc
 MAGICMODE=	444
 
 SRCDIR=		${.CURDIR}/../../contrib/file
@@ -51,12 +52,17 @@
 magic:	$(MAGFILES)
 	cat $(MAGFILES) > $(.TARGET)
 
+magic.mgc: file magic
+	./file -C -m magic
+
 CLEANFILES+=	print-hacked.c
 print-hacked.c: print.c
 	sed -e 's|daylight|0/*daylight*/|g' ${.ALLSRC} > ${.TARGET}
 
-beforeinstall:
+beforeinstall: magic.mgc
 	$(INSTALL) $(COPY) -o $(BINOWN) -g $(BINGRP) -m $(MAGICMODE) \
 	    magic $(DESTDIR)$(MAGICFILE)
+	$(INSTALL) $(COPY) -o $(BINOWN) -g $(BINGRP) -m $(MAGICMODE) \
+	    magic.mgc $(DESTDIR)$(MAGICDB)
 
 .include <bsd.prog.mk>





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




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