View Issue Details

IDProjectCategoryView StatusLast Update
0000109file[All Projects] Generalpublic2019-09-27 12:10
ReporterbcbAssigned To 
Status newResolutionopen 
PlatformLinuxOSArch LinuxOS Version
Product Version5.37 
Target VersionFixed in Version 
Summary0000109: reStructuredText with embedded code detected as Python script
DescriptionWe're documenting our Python project with reStructuredText files. These contain various snippets of Python code which serve as examples. I've attached a simple document showing this.

When run on this document, file picks up on the embedded code and detects it as a Python script:

$ file -v
magic file from /usr/share/file/misc/magic
$ file document.rst
document.rst: Python script, ASCII text executable
$ file -b --mime-type document.rst

The particular use-case where we ran into this was in a Git hook which runs a code formatting tool to reject any Python code which doesn't meet the project coding style. It was using file to only run the checker on Python files. For the time being we've changed this to a simple file extension test.

Note that it doesn't happen on every document, just those with enough magic matches to get the strength high enough. On documents which don't meet the threshold it reports "ASCII text text/plain". Ideally, it would report this in all cases.
TagsNo tags attached.



2019-09-27 12:10


document.rst (566 bytes)

Issue History

Date Modified Username Field Change
2019-09-27 12:10 bcb New Issue
2019-09-27 12:10 bcb File Added: document.rst