From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 6 12:30:02 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 349D81065672 for ; Mon, 6 Aug 2012 12:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 081478FC0A for ; Mon, 6 Aug 2012 12:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q76CU1uE038542 for ; Mon, 6 Aug 2012 12:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q76CU1Wr038541; Mon, 6 Aug 2012 12:30:01 GMT (envelope-from gnats) Resent-Date: Mon, 6 Aug 2012 12:30:01 GMT Resent-Message-Id: <201208061230.q76CU1Wr038541@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stephen McKay Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E47C1106566B for ; Mon, 6 Aug 2012 12:29:36 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id B64DF8FC08 for ; Mon, 6 Aug 2012 12:29:36 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q76CTahf025291 for ; Mon, 6 Aug 2012 12:29:36 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q76CTaTM025290; Mon, 6 Aug 2012 12:29:36 GMT (envelope-from nobody) Message-Id: <201208061229.q76CTaTM025290@red.freebsd.org> Date: Mon, 6 Aug 2012 12:29:36 GMT From: Stephen McKay To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/170415: file(1) fails to detect troff (and other file types) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 12:30:02 -0000 >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: