Subject: Re: bin/962: file(1) doesn't recognize man pages beginning with .\" as [nt]roff
To: None <netbsd-bugs@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: netbsd-bugs
Date: 04/14/1995 06:51:56
> "file" keeps misinterpreting man pages that begin with .\" as
> "English text":  [demo]

>> Fix:
> 	Unknown as yet.  Some test in ascmagic() isn't working, methinks.

Fix is very simple: make the test you quoted check for what it's
supposed to be checking for.

At its most rudimentary, this would be (consed up by hand, so no diff

                  while (isascii(*tp) && isspace(*tp))
                          ++tp;   /* skip leading whitespace */
                  if ((isascii(*tp) && (isalnum(*tp) || *tp=='\\') &&
-                     isascii(*(tp+1)) && (isalnum(*(tp+1)) || *tp=='"'))) {
+                     isascii(*(tp+1)) && (isalnum(*(tp+1)) || *(tp+1)=='"'))) {
                          ckfputs("troff or preprocessor input text", stdout);
                          return 1;

IMO another change is crying out to be made; I would strongly suggest
changing *(tp+1) to tp[1].

Of course, even with this change it's still possible to mistake a tar
archive whose first filename begins with .\" or .xx for [nt]roff input.
Perhaps file should do a tar header consistency check on the first

					der Mouse