Date: Mon, 6 Aug 2012 12:29:36 GMT From: Stephen McKay <mckay@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/170415: file(1) fails to detect troff (and other file types) Message-ID: <201208061229.q76CTaTM025290@red.freebsd.org> Resent-Message-ID: <201208061230.q76CU1Wr038541@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 170415 >Category: bin >Synopsis: file(1) fails to detect troff (and other file types) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 06 12:30:01 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Stephen McKay >Release: 9.1-beta1 >Organization: >Environment: >Description: A bug was introduced into file(1) 5.11 when it was imported into the FreeBSD base. Detection of troff files (and others) has been broken. This is because "search" and "regex" patterns are no longer correctly processed by "mkmagic", the program that compiles /usr/share/misc/magic.mgc from the individual pattern files. >How-To-Repeat: $ echo '.tr' > foo $ file foo foo: ASCII text Expected behaviour is: $ file foo foo: troff or preprocessor input, ASCII text >Fix: Apply the (hopefully) attached patch against 10-current. Patch attached with submission follows: Index: contrib/file/apprentice.c =================================================================== RCS file: /cvs/src/contrib/file/apprentice.c,v retrieving revision 1.7 diff -u -r1.7 apprentice.c --- contrib/file/apprentice.c 19 Apr 2012 03:20:13 -0000 1.7 +++ contrib/file/apprentice.c 6 Aug 2012 12:01:01 -0000 @@ -648,7 +648,6 @@ break; case FILE_REGEX: case FILE_SEARCH: -#ifndef COMPILE_ONLY /* Check for override */ if (mstart->str_flags & STRING_BINTEST) mstart->flag |= BINTEST; @@ -664,7 +663,6 @@ mstart->flag |= BINTEST; else mstart->flag |= TEXTTEST; -#endif break; case FILE_DEFAULT: /* can't deduce anything; we shouldn't see this at the Index: lib/libmagic/Makefile =================================================================== RCS file: /cvs/src/lib/libmagic/Makefile,v retrieving revision 1.18 diff -u -r1.18 Makefile --- lib/libmagic/Makefile 19 May 2012 02:30:10 -0000 1.18 +++ lib/libmagic/Makefile 6 Aug 2012 12:02:03 -0000 @@ -39,7 +39,7 @@ CLEANFILES+= mkmagic build-tools: mkmagic -mkmagic: apprentice.c funcs.c getline.c magic.c print.c +mkmagic: apprentice.c encoding.c funcs.c getline.c magic.c print.c ${CC} ${CFLAGS} -DCOMPILE_ONLY -DHOSTPROG ${LDFLAGS} \ -o ${.TARGET} ${.ALLSRC} >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208061229.q76CTaTM025290>