View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000676 | file | General | public | 2025-07-12 21:45 | 2025-07-27 23:08 |
Reporter | vinc17 | Assigned To | christos | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | ||
Product Version | 5.46 | ||||
Summary | 0000676: troff file misidentified as C source | ||||
Description | Man 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 Information | The 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. | ||||
Tags | No tags attached. | ||||
|
Perhaps an earlier magic match should be given more weight, but that could break other things. |
|
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. |