From owner-freebsd-audit Tue Aug 7 10:24:10 2001 Delivered-To: freebsd-audit@freebsd.org Received: from alpo.whistle.com (s206m1.whistle.com [207.76.206.1]) by hub.freebsd.org (Postfix) with ESMTP id 388B037B405 for ; Tue, 7 Aug 2001 10:24:06 -0700 (PDT) (envelope-from mark@whistle.com) Received: from [207.76.207.129] (PBG4.whistle.com [207.76.207.129]) by alpo.whistle.com (8.9.1a/8.9.1) with ESMTP id KAA38143; Tue, 7 Aug 2001 10:22:31 -0700 (PDT) Mime-Version: 1.0 X-Sender: mark-ml@207.76.206.1 Message-Id: In-Reply-To: <20010806055759.E586@ringworld.oblivion.bg> References: <20010806055759.E586@ringworld.oblivion.bg> Date: Tue, 7 Aug 2001 10:23:01 -0700 To: Peter Pentchev From: Mark Peek Subject: Re: [PATCH] fix a file(1) minor POLA stretching Cc: audit@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message