View Issue Details

IDProjectCategoryView StatusLast Update
0000676fileGeneralpublic2025-07-27 23:08
Reportervinc17 Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version5.46 
Summary0000676: troff file misidentified as C source
DescriptionMan pages (in troff format) containing a C source are misidentified as C source.
Steps To Reproduce$ printf ".TH frexp 3 D L\n.SH E\n.SS S\n.EX\n#include <float.h>\n.EE\n" | file -
/dev/stdin: C source, ASCII text

Without the "#include <float.h>", the issue disappears:
$ printf ".TH frexp 3 D L\n.SH E\n.SS S\n.EX\n.EE\n" | file -
/dev/stdin: troff or preprocessor input, ASCII text
Additional InformationThe above file (output without the "| file -") is

.TH frexp 3 D L
.SH E
.SS S
.EX
#include <float.h>
.EE

I've found this issue with the frexp(3) man page from the Linux man-pages.
TagsNo tags attached.

Activities

christos

2025-07-23 18:55

manager   ~0004276

Perhaps an earlier magic match should be given more weight, but that could break other things.

vinc17

2025-07-27 23:08

reporter   ~0004279

C code may appear inside various file formats. I think that a good heuristic to recognize a C file would be to ensure that the beginning of the file looks like C: most C files start with a comment or a preprocessor directive; but standard C keywords should be checked too as possibly starting a C file.

Issue History

Date Modified Username Field Change
2025-07-12 21:45 vinc17 New Issue
2025-07-23 18:55 christos Assigned To => christos
2025-07-23 18:55 christos Status new => assigned
2025-07-23 18:55 christos Note Added: 0004276
2025-07-27 23:08 vinc17 Note Added: 0004279