Bug 106330 - Shared-mime-info 1.9-1 - all .iso files are recognized as stl-binary. Breaks file association. KDE Plasma, Arch Linux
Summary: Shared-mime-info 1.9-1 - all .iso files are recognized as stl-binary. Breaks ...
Status: RESOLVED FIXED
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Shared Mime Info group
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-01 09:13 UTC by mo78
Modified: 2018-06-04 11:27 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Mafia III screenshots (402.23 KB, application/force-download)
2018-05-11 21:00 UTC, mo78
Details
kioclient5 openProperties (187.78 KB, image/png)
2018-05-13 18:15 UTC, mo78
Details

Description mo78 2018-05-01 09:13:17 UTC
All .iso are recognized as stl-binary. BIOS files and .GHO images too. Breaks file association. KDE Plasma, Arch Linux.
Comment 1 mo78 2018-05-01 20:06:10 UTC
Excuse me to not mention - shared-mime-info 1.9-1. Reverting to 1.6-1 solves the problem.
Comment 2 mo78 2018-05-07 12:11:04 UTC
Anybody? This is a serious problem. One cannot assign application associations to this type of files.
Comment 3 Bastien Nocera 2018-05-09 09:37:53 UTC
(In reply to mo78 from comment #0)
> All .iso are recognized as stl-binary. BIOS files and .GHO images too.
> Breaks file association. KDE Plasma, Arch Linux.

Obviously not all, as there are ISO images in the test suite, and they're detected correctly. I don't have enough information here to replicate the problem. Please make the first few megabytes of a couple of problematic files available.

(In reply to mo78 from comment #2)
> Anybody? This is a serious problem. One cannot assign application
> associations to this type of files.

You've listed a work-around in comment 1. If you need urgent fixes, there are a number of companies that will do that for you for a fee.
Comment 4 mo78 2018-05-09 10:35:22 UTC
I don't know how to do that but all of my .iso files are recognized as stl-binary and I have many of them - over 400.

https://s9.postimg.cc/6kxqe1b6n/Screenshot_20180509_133327.png

As you can see the icon is missing and the file association is broken.

https://s9.postimg.cc/55w5pdf9b/image.png
Comment 5 Bastien Nocera 2018-05-09 11:21:24 UTC
(In reply to mo78 from comment #4)
> I don't know how to do that but all of my .iso files are recognized as
> stl-binary and I have many of them - over 400.
> 
> https://s9.postimg.cc/6kxqe1b6n/Screenshot_20180509_133327.png
> 
> As you can see the icon is missing and the file association is broken.
> 
> https://s9.postimg.cc/55w5pdf9b/image.png

All the ISOs appear fine in GNOME, so it's likely a bug in KDE. David?
Comment 6 David Faure 2018-05-11 19:06:29 UTC
Works fine for me too with Qt/KDE code, I suspect this is rather interference from another mimetypes package file on your system. What does this command return?

grep '\*\.iso' /usr/share/mime/packages/*
Comment 7 David Faure 2018-05-11 19:10:34 UTC
Also grep for stl-binary... it shows up in /usr/share/mime/packages/freedesktop.org.xml for me, but that's not associated to the *.iso extension.

Also, what does `kmimetypefinder5 file.iso` say? (with and without the -f option)

(The image links don't work for me).
Comment 8 mo78 2018-05-11 21:00:40 UTC
Created attachment 139504 [details]
Mafia III screenshots
Comment 9 mo78 2018-05-11 21:08:16 UTC
The links with the pictures are working fine but I made an attachment for you, I just mistyped the name of the attachment for I recently filed a bug about Mafia III game. I'm sorry for that :)

Here you are what you ask:

grep '\*\.iso' /usr/share/mime/packages/*
/usr/share/mime/packages/freedesktop.org.xml:    <glob weight="80" pattern="*.iso"/>
/usr/share/mime/packages/freedesktop.org.xml:    <glob pattern="*.iso9660"/>
/usr/share/mime/packages/freedesktop.org.xml:    <glob pattern="*.iso"/>
/usr/share/mime/packages/freedesktop.org.xml:    <glob pattern="*.iso"/>
/usr/share/mime/packages/freedesktop.org.xml:    <glob pattern="*.iso"/>
/usr/share/mime/packages/freedesktop.org.xml:    <glob pattern="*.iso"/>


grep '\*\.stl-binary' /usr/share/mime/packages/* says nothing.

kmimetypefinder5 file.iso gives:

application/x-cd-image
Comment 10 mo78 2018-05-11 21:09:36 UTC
And kmimetypefinder5 file.iso -f:
application/x-cd-image
Comment 11 David Faure 2018-05-13 14:09:42 UTC
So kmimetypefinder5 shows that the Qt is able to detect the mimetype just fine. But do try it on the same .iso file you're opening in the properties dialog, to be sure:
    kmimetypefinder5 "Car Mechanic Simulator 2015.iso"

Also try
    kioclient5 openProperties "Car Mechanic Simulator 2015.iso"
to see if it shows anything different. For me (with tests/iso-file.iso from shared-mime-info sources) it does show "raw CD image" correctly in the properties dialog.

In any case this is starting to sound like material for a KDE bug report rather than a shared-mime-info bug report.
Comment 12 mo78 2018-05-13 18:14:35 UTC
Thank you :) Where we go:

kmimetypefinder5 "Car Mechanic Simulator 2015.iso"
model/x.stl-binary

For kioclient5 openProperties "Car Mechanic Simulator 2015.iso" I made an attachment. Thank you once again :)
Comment 13 mo78 2018-05-13 18:15:07 UTC
Created attachment 139547 [details]
kioclient5 openProperties
Comment 14 mo78 2018-05-13 18:16:15 UTC
*Here we go:
Comment 15 David Faure 2018-05-14 07:45:56 UTC
OK I see what's happening.

freedesktop.org.xml has the *.iso glob for multiple mimetypes:
application/x-cd-image:*.iso
application/x-sega-cd-rom:*.iso
application/x-saturn-rom:*.iso
application/x-wii-rom:*.iso
application/x-gamecube-rom:*.iso

Therefore we have to look at the contents of the file, and for some reason this particular file matches the magic rules for stl-binary.
stl-binary doesn't inherit from any of the candidates above, so that doesn't help choosing one, so we stick to stl-binary.

One issue might be that my implementation in Qt stops at the first magic match, no matter the accuracy number associated to it.

But, hmm, x-cd-image has no magic rules at all, so there's no chance for it to win that fight.

Does anyone know if we can come up with magic rules for x-cd-image?
Comment 16 mo78 2018-05-14 08:44:10 UTC
Excuse me if I don't understand you right but almost all .iso files are recognized as stl-binary, not only this one, including . GHO and BIOS settings files. If I download Linux Mint 18.3 original .iso for example, it is treated as Apple Disk Image:

http://i65.tinypic.com/jfgbgh.png

But the big part of .isos are recognized as stl-binary.

Here you are .GHO:

http://i67.tinypic.com/2j4cy9x.png

Original AOMEI Pro Bootable CD:

http://i68.tinypic.com/n5off7.png

Original Norton Ghost Bootable ISO:

http://i66.tinypic.com/iqd6hu.png

And BIOS saved settings file:

http://i68.tinypic.com/a4bgwp.png

And so on. Do you see the screenshots?
Comment 17 Bastien Nocera 2018-05-14 11:29:11 UTC
(In reply to David Faure from comment #15)
> OK I see what's happening.
> 
> freedesktop.org.xml has the *.iso glob for multiple mimetypes:
> application/x-cd-image:*.iso
> application/x-sega-cd-rom:*.iso
> application/x-saturn-rom:*.iso
> application/x-wii-rom:*.iso
> application/x-gamecube-rom:*.iso
> 
> Therefore we have to look at the contents of the file, and for some reason
> this particular file matches the magic rules for stl-binary.
> stl-binary doesn't inherit from any of the candidates above, so that doesn't
> help choosing one, so we stick to stl-binary.
> 
> One issue might be that my implementation in Qt stops at the first magic
> match, no matter the accuracy number associated to it.
> 
> But, hmm, x-cd-image has no magic rules at all, so there's no chance for it
> to win that fight.
> 
> Does anyone know if we can come up with magic rules for x-cd-image?

1591     <!-- No magic, see https://bugs.freedesktop.org/show_bug.cgi?id=10049 -->•

I'd start by adding a problematic ISO to the test suite.
Comment 18 David Faure 2018-05-15 13:18:13 UTC
(In reply to mo78 from comment #16)
> Excuse me if I don't understand you right but almost all .iso files are
> recognized as stl-binary, not only this one, including . GHO and BIOS
> settings files.

Can you give me the URL of the smallest iso file you can find that is misdetected? Thanks.
Comment 19 mo78 2018-05-15 14:26:46 UTC
Here you are, it's just 3.2 MB:

https://mega.nz/#!DcgjiYbJ!fFUL2YwgyTqdYXlLGr6kM4qrx-8QGM9G2k_c6_6YcAg

Thank you :)
Comment 20 mo78 2018-06-04 10:39:59 UTC
Hello, is there any progress on this? The status is "needinfo". What additional info can I provide to you?
Comment 21 Bastien Nocera 2018-06-04 11:27:22 UTC
commit 7c7f84e2a77f4142cf77ebdf239deaa14c842f9c
Author: Bastien Nocera <hadess@hadess.net>
Date:   Mon Jun 4 13:25:30 2018 +0200

    Remove magic from STL binary
    
    3-NUL bytes aren't enough to be sure that this will only ever match STL
    binary headers.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=106330

commit 1e6b421a6c8c2dce3e430a4e2b963a9efd369aa2
Author: Bastien Nocera <hadess@hadess.net>
Date:   Mon Jun 4 13:23:29 2018 +0200

    Add test for bug 106330
    
    The first 32k of an ISO file.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.