Subject: bin/962: file(1) doesn't recognize man pages beginning with .\" as [nt]roff
To: None <gnats-admin@NetBSD.ORG>
From: None <earle@netbsd4me.jpl.nasa.gov>
List: netbsd-bugs
Date: 04/14/1995 00:50:05
>Number: 962
>Category: bin
>Synopsis: file doesn't recognize files beginning with .\" as [nt]roff
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 14 00:50:03 1995
>Originator: Greg &
>Organization:
JPL
>Release: 1.0
>Environment:
System: NetBSD netbsd4me 1.0 NetBSD 1.0 (NETBSD4ME) #3: Fri Feb 10 12:10:19 PST 1995 earle@netbsd4me:/usr/src/1.0/usr/src/sys/arch/sparc/compile/NETBSD4ME sparc
>Description:
According to /usr/src/usr.bin/file/ascmagic.c:ascmagic():
/* these are easy, do them first */
/*
* for troff, look for . + letter + letter or .\";
* this must be done to disambiguate tar archives' ./file
* and other trash from real troff input.
*/
if (*buf == '.') {
unsigned char *tp = buf + 1;
while (isascii(*tp) && isspace(*tp))
++tp; /* skip leading whitespace */
if ((isascii(*tp) && (isalnum(*tp) || *tp=='\\') &&
isascii(*(tp+1)) && (isalnum(*(tp+1)) || *tp=='"'))) {
ckfputs("troff or preprocessor input text", stdout);
return 1;
}
}
Yet "file" keeps misinterpreting man pages that begin with .\" as "English
text":
netbsd4me:1:38 % head -1 sup.1 unzip.1 unzipsfx.1 zipinfo.1 funzip.1
==> sup.1 <==
.\" Copyright (c) 1992 Carnegie Mellon University
==> unzip.1 <==
.\" Info-ZIP grants permission to any individual or institution to use, copy,
==> unzipsfx.1 <==
.\" Info-ZIP grants permission to any individual or institution to use, copy,
==> zipinfo.1 <==
.\" Info-ZIP grants permission to any individual or institution to use, copy,
==> funzip.1 <==
.\" Info-ZIP grants permission to any individual or institution to use, copy,
netbsd4me:1:39 % file sup.1 unzip.1 unzipsfx.1 zipinfo.1 funzip.1
sup.1: English text
unzip.1: English text
unzipsfx.1: English text
zipinfo.1: English text
funzip.1: English text
Seems like a test is sneaking through somehow ...
(I noticed this because my "man2html" converter bitches if "file" doesn't
return something with "roff" in it ... )
- Greg
>How-To-Repeat:
Run file(1) on the "sup" man page, for example
>Fix:
Unknown as yet. Some test in ascmagic() isn't working, methinks.
>Audit-Trail:
>Unformatted: