Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Aug 2001 05:57:59 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        David O'Brien <obrien@FreeBSD.org>
Cc:        audit@FreeBSD.org
Subject:   [PATCH] fix a file(1) minor POLA stretching
Message-ID:  <20010806055759.E586@ringworld.oblivion.bg>

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

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.

G'luck,
Peter

-- 
If I were you, who would be reading this sentence?

Index: src/usr.bin/file/Makefile
===================================================================
RCS file: /home/ncvs/src/usr.bin/file/Makefile,v
retrieving revision 1.18
diff -u -r1.18 Makefile
--- src/usr.bin/file/Makefile	2001/07/30 03:50:04	1.18
+++ src/usr.bin/file/Makefile	2001/08/06 02:56: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
@@ -40,17 +41,20 @@
 
 MAN=		file.1 magic.5
 
-CLEANFILES+=	magic
+CLEANFILES+=	magic magic.mgc
 
 MAGFILES=	${SRCDIR}/Header\
 		${SRCDIR}/Localstuff\
 		${SRCDIR}/Magdir/[a-z]*
 
-all:	file magic
+all:	file magic magic.mgc
 
 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}
@@ -58,5 +62,7 @@
 beforeinstall:
 	$(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?20010806055759.E586>