Most BSD makefiles are not recognized by /usr/bin/file as such. Worse, if less is configured to use lesspipe from the ports (misc/lesspipe), then many BSD makefiles are recognized as troff files, causing unreadable input. Fix: Maybe adding keywords as ".if", ".include", ".else" etc. as BSD makefile keywords before the troff section could help. How-To-Repeat: For example: cd /usr/share/mk /usr/bin/file * | grep -i troff | wc -l Or configure less to use lesspipe as per lesspipe's manpage (see FILTER ACTIVATION section) and try to use less on any of misrecognized BSD makefiles.
FreeBSD 10.1 is also affected.
This is still reproducible on -HEAD (file-5.23). Looks like I can extend magic/Magdir/make to add a few regex to work around this, but it's not clear if that's the right thing to do so I think it's reasonable to add the file(1) author. The following regex may be useful: \^PROG= \^PROG_CXX= \^MAN \^\.include\ < etc.
I aded some patterns on HEAD of magic/Magdir/make...
A commit references this bug: Author: delphij Date: Fri Sep 4 05:56:18 UTC 2015 New revision: 287453 URL: https://svnweb.freebsd.org/changeset/base/287453 Log: MFV r287451 + 287452: file 5.24 + fix for bin/181436. PR: 181436 MFC after: 2 weeks Changes: _U head/contrib/file/ head/contrib/file/ChangeLog head/contrib/file/configure head/contrib/file/configure.ac head/contrib/file/magic/Magdir/database head/contrib/file/magic/Magdir/elf head/contrib/file/magic/Magdir/fortran head/contrib/file/magic/Magdir/mail.news head/contrib/file/magic/Magdir/make head/contrib/file/magic/Magdir/map head/contrib/file/src/file.c head/contrib/file/src/funcs.c head/contrib/file/src/readelf.c head/lib/libmagic/config.h
Patched in -HEAD.
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
(In reply to Christos Zoulas from comment #3) While the situation is a little bit better now (especially with inclusion of ".include") still many (all?) ".if" containing BSD makefiles are recognized as troff files --- I guess this is due to the magic line 0 regex/20l \^\\.[A-Za-z0-9][A-Za-z0-9][\ \t] troff or preprocessor input text
should be fixed in HEAD.
There is a commit referencing this PR, but it's still not closed and has been inactive for some time. Closing the PR as fixed but feel free to re-open it if the issue hasn't been completely resolved. Thanks