[File] Python file misdetection
Steve Grubb
sgrubb at redhat.com
Tue Nov 29 22:37:11 UTC 2022
Hello,
I run across a case where python files get misdetected when an import
statement is commented out. For example:
#!/usr/bin/python3
import os
os.system("ls")
file --mime-type example.py
example.py: text/x-script.python
#!/usr/bin/python3
#import os
os.system("ls")
file --mime-type example.py
example.py: text/x-objective-c
It matches Objective-C with a strength of 25, where #!\040/usr/bin/python has
a strength of 15. It would seem very plausible for someone to occassionally
comment out an import statement. I'm wondering why an Objective-C construct
would be stronger than a python shebang (which should be conclusive)? Not
sure which of the two to adjust.
Best Regards,
-Steve
More information about the File
mailing list