[File] Question regarding python bytecode mimetypes

Steve Grubb sgrubb at redhat.com
Thu May 13 19:29:58 UTC 2021


Hello,

I wanted to raise this issue again since it appears that the latest file 
package is now in Fedora 34. The issue is pyc python bytecode files are being 
misidentified. The libmagic code has it as "text", whereas others have it as 
"application". If I check other libraries such as shared-mime-info, they also 
have it as application:

# rpm -ql shared-mime-info | grep python-bytecode
/usr/share/mime/application/x-python-bytecode.xml

Looking on a table from w3docs, it's also documented as application:
https://www.w3docs.com/learn-html/mime-types.html

I think the issue is that text means its an ASCII file with characters < 128. 
Where application is intended for consumption by an application such as the 
python interpreter and the bytes can be any value. The pyc files have bytes of 
all values.

Is there any chance of correcting this?

Best Regards,
-Steve

On Friday, November 13, 2020 12:30:11 PM EDT Steve Grubb wrote:
> On Wednesday, October 14, 2020 2:02:23 PM EST Steve Grubb wrote:
> > On Wednesday, October 14, 2020 3:15:07 AM EDT Mircea GLIGA wrote:
> > > I'm reiterating my question here, is this correct behavior?
> > > For me, considering bytecode as text is a bug and should be fixed.
> > 
> > I think you are right. Back in Feb I reported this issue:
> > https://mailman.astron.com/pipermail/file/2020-February/000272.html
> > 
> > But I suggested application rather than text since these are compiled.
> > I'm guessing it's just a typo.
> 
> I'm attaching a patch against git that moves text/x-bytecode.python to
> application/x-bytecode.python. File-5.39 is now in Fedora 33 and is
> starting to cause problems with rules depending on the old name.
> 
> Best Regards,
> -Steve






More information about the File mailing list