Problems with 'file --exclude troff'

Randy McMurchy randy at
Thu Oct 9 01:04:25 PDT 2008

Hi all,

I'm new to this list but I searched the archives for
anything that might be related to the issue I'm about
to describe and couldn't find anything so I thought
I'd bring it up here.

It was brought to my attention that sometime after
the 4.23 release the -e (--exclude) parameter did not
work for the 'troff' test. Using 4.26, I looked into
into the code and found the following:

Using the output from the man page, there are 3 -e
tests that don't work. The 'fortran', 'token', and
'troff' tests. Seems to me looking through the ChangeLog
that the 'fortran' test was converted into a 'soft'
test, so that explains why that one wouldn't work
(though the man page could use updating).

The 'token' test fails, because the man page actually
identifies it incorrectly and it should be 'tokens'
instead. I can't figure out the 'troff' test as there
isn't anything in any of the ChangeLogs that show that
it was intentionally removed.

Anyway, I created this patch (which probably is wrong
because I re-enabled the fortran test), but it does
fix the 'tokens' and 'troff' tests.

Please let me know if indeed the 'troff' exclude test
was intentionally removed, or if it had been done by
mistake somehow.

Patch follows:

diff -Naur file-orig/doc/ file-4.26/doc/
--- file-orig/doc/      2008-03-07 15:00:07.000000000 +0000
+++ file-4.26/doc/      2008-10-08 13:57:37.000000000 +0000
@@ -192,7 +192,7 @@
  Don't consult magic files.
  .It tar
  Don't examine tar files.
-.It token
+.It tokens
  Don't look for known tokens inside ascii files.
  .It troff
  Don't look for troff sequences inside ascii files.

diff -Naur file-orig/src/file.c file-4.26/src/file.c
--- file-orig/src/file.c        2008-07-03 15:48:18.000000000 +0000
+++ file-4.26/src/file.c        2008-10-08 13:59:14.000000000 +0000
@@ -148,9 +148,11 @@
                 { "ascii",      MAGIC_NO_CHECK_ASCII },
                 { "compress",   MAGIC_NO_CHECK_COMPRESS },
                 { "elf",        MAGIC_NO_CHECK_ELF },
+               { "fortran",    MAGIC_NO_CHECK_FORTRAN },
                 { "soft",       MAGIC_NO_CHECK_SOFT },
                 { "tar",        MAGIC_NO_CHECK_TAR },
                 { "tokens",     MAGIC_NO_CHECK_TOKENS },
+               { "troff",      MAGIC_NO_CHECK_TROFF },

         /* makes islower etc work for other langs */


More information about the lfs-dev mailing list