Bug 80877 - [shared-mime-info] update from 1.2-2 to 1.3-1 "breaks" .iso files (.txt file icon / behavior).
Summary: [shared-mime-info] update from 1.2-2 to 1.3-1 "breaks" .iso files (.txt file ...
Status: RESOLVED MOVED
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: freedesktop.org.xml (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Shared Mime Info group
QA Contact:
URL:
Whiteboard:
Keywords:
: 106936 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-07-03 23:10 UTC by AndrzejL
Modified: 2018-10-13 10:40 UTC (History)
9 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch fix the problem (937 bytes, patch)
2014-11-13 09:56 UTC, marguerite
Details | Splinter Review
ISO viewed in midnight commander (143.26 KB, text/plain)
2015-02-23 21:16 UTC, Roman Bysh
Details
openSUSE ISO with Preferences viewed in Dolphin using KDE4.14.4 (59.11 KB, text/plain)
2015-02-23 21:18 UTC, Roman Bysh
Details
Correct upload of openSUSE ISO (59.11 KB, image/png)
2015-02-23 21:21 UTC, Roman Bysh
Details
ISO png file viewed in midnight commander (143.26 KB, image/png)
2015-02-26 23:53 UTC, Roman Bysh
Details

Description AndrzejL 2014-07-03 23:10:37 UTC
Hi there.

This is an issue that is out there for quite a while (31 May 2014) although I have just recently noticed it.

shared-mime-info update from 1.2-2 to 1.3-1 "breaks" .iso files (.txt file icon / behavior).

pacman -Qi shared-mime-info

Name : shared-mime-info
Version : 1.3-1
Description : Freedesktop.org Shared MIME Info
Architecture : i686
URL : http://freedesktop.org/Software/shared-mime-info
Licenses : GPL2
Groups : None
Provides : None
Depends On : libxml2 glib2
Optional Deps : None
Required By : akonadi cmake fceux gtk2 gtk3 kdelibs libreoffice-common virtualbox
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 4104.00 KiB
Packager : CENSORED for privacy purposes.
Build Date : Sat 31 May 2014 19:16:25 IST
Install Date : Mon 30 Jun 2014 15:33:46 IST
Install Reason : Installed as a dependency for another package
Install Script : Yes
Validated By : Signature

I have found confirmation here:

https://bbs.archlinux.org/viewtopic.php?id=182287

All You have to do is upgrade as usual (at least in Arch Linux). Open lets say Dolphin file manager. Browse to any folder that contains lets say Arch Linux iso. You will notice that the iso has a .txt file icon. Also if You right click on it and choose "Open With" You will get text editors.

http://postimg.org/image/d791o7urx/

Its not a major issue but it can be annoying :).

Thanks in advance.

Kind regards.

Andrzej
Comment 1 Bastien Nocera 2014-07-04 07:27:20 UTC
Can't reproduce here in nautilus, so I'm guessing it's a regression in your file manager.
Comment 2 AndrzejL 2014-07-04 09:06:01 UTC
Installed nautilus. It shows .iso files just fine indeed...

I will leave this open for a while and will try getting KDE / dolphin devs attention.

Thanks Bastien!
Comment 3 AndrzejL 2014-07-04 09:38:31 UTC
Reported it here:

https://bugs.kde.org/show_bug.cgi?id=337035

Just in case someone search for the continuation.

Cheers.

Andrzej
Comment 4 Bastien Nocera 2014-07-04 14:19:27 UTC
Please reopen if it turns out to be a shared-mime-info bug nonetheless.
Comment 5 marguerite 2014-11-13 09:56:58 UTC
Created attachment 109396 [details] [review]
patch fix the problem

Hi,

Can you review this again please?

I think this commit cause the problem:

http://cgit.freedesktop.org/xdg/shared-mime-info/commit/?id=4b0bc62b3e50f25d0ef42950e0b715274637c548

After commenting the "Wii disc image" and "GameCube disc image" block,

The mimetype is correct again. 

This commit was made exactly between 1.2 and 1.3.

I think there's some conflict between these *.iso glob matches, so it fallbacks to .txt. That's my theory, but you're the expert :-)


Thanks

Marguerite
Comment 6 Roman Bysh 2014-11-19 21:27:08 UTC
I was able to replicate marguerite's findings on my openSUSE 13.2 KDE 4.14.2.

The commit patch for "Add PC Engine, GameCube and Wii "ROM" types" is the culprit. See: http://cgit.freedesktop.org/xdg/shared-mime-info/commit/?id=4b0bc62b3e50f25d0ef42950e0b715274637c548
Dated 2014-01-19

I downloaded shared-mime-info v1.2, extracted the freedesktop.org.xml file to
/usr/share/mime/packages/ and it fixed the iso file association.

I also tested the problem commit patch by commenting out the entire block.
It fixed the problem.

The file association returned to the correct raw CD image file association.
Including the icon.
Comment 7 Rex Dieter 2015-01-22 13:46:32 UTC
Resetting assignee
Comment 8 Bastien Nocera 2015-01-28 11:31:24 UTC
(In reply to marguerite from comment #5)
> Created attachment 109396 [details] [review] [review]
> patch fix the problem
> 
> Hi,
> 
> Can you review this again please?
> 
> I think this commit cause the problem:
> 
> http://cgit.freedesktop.org/xdg/shared-mime-info/commit/
> ?id=4b0bc62b3e50f25d0ef42950e0b715274637c548
> 
> After commenting the "Wii disc image" and "GameCube disc image" block,
> 
> The mimetype is correct again. 
> 
> This commit was made exactly between 1.2 and 1.3.
> 
> I think there's some conflict between these *.iso glob matches, so it
> fallbacks to .txt. That's my theory, but you're the expert :-)

There is a conflict. The file manager is supposed to use the magic to differentiate the mime-types. Is it doing that? I'm guessing it isn't.
Comment 9 Roman Bysh 2015-01-29 20:00:36 UTC
Is there a way of adding a higher priority to the two glob patterns?

<glob pattern="*.iso"/>
<glob pattern="*.iso9660"/>
Comment 10 Roman Bysh 2015-01-31 22:18:32 UTC
Follow Up

Can you please consider adding the "glob weight" as shown below?

 <glob weight="60" pattern="*.iso"/>
 <glob weight="60" pattern="*.iso9660"/>

Then run: update-mime-database /usr/share/mime


Any thoughts?
Comment 11 Roman Bysh 2015-02-09 02:16:39 UTC
Follow up please. I think this will resolve the problem.

Can you please consider adding this to shared-mime-info 1.4?
Many users are waiting for this correction.
Comment 12 Florian Hubold 2015-02-17 17:54:59 UTC
(In reply to Roman Bysh from comment #11)
> Follow up please. I think this will resolve the problem.

Works pretty well here. Before, a lot of "text/plain (accuracy 5)"


for i in *iso; do echo $i $(kmimetypefinder $i 2>/dev/null) ; done
chakra-2012.10-Claire-x86_64.iso text/plain (accuracy 5)
chakra-2013.03-Benz-x86_64.iso text/plain (accuracy 5)
Hybryde_Evolution_v1-live-dvd-32bits.iso application/x-cd-image (accuracy 20)
kali-linux-1.0.2-amd64.iso text/plain (accuracy 5)
kubuntu-13.04-beta1-desktop-amd64.iso application/x-cd-image (accuracy 20)
linuxmint-14-kde-dvd-64bit.iso text/plain (accuracy 5)
live-razorqt-20121023-i586.iso application/x-cd-image (accuracy 20)
Mandriva_Pulse_Demo_1.4.2.iso application/x-cd-image (accuracy 20)
maui-0.5.1-x86_64.iso text/plain (accuracy 5)
maui-0.5.1-x86.iso text/plain (accuracy 5)
MBS_1.0-soho.x86_64.iso application/x-cd-image (accuracy 20)
Minimal_Klyde.x86_64-0.1.2.iso text/plain (accuracy 5)
ocz_tools_316.iso application/x-cd-image (accuracy 20)
siduction-12.2.0-ridersonthestorm-rqt-amd64-201212092240.iso text/plain (accuracy 5)
SolusOS-amd64-1-2.iso text/plain (accuracy 5)
solydk64_201306.iso text/plain (accuracy 5)
trinity-rescue-kit.3.4-build-372.iso application/x-cd-image (accuracy 20)


And afterwards, all images "application/x-cd-image (accuracy 100)":

for i in *iso; do echo $i $(kmimetypefinder $i 2>/dev/null) ; done
chakra-2012.10-Claire-x86_64.iso application/x-cd-image (accuracy 100)
chakra-2013.03-Benz-x86_64.iso application/x-cd-image (accuracy 100)
Hybryde_Evolution_v1-live-dvd-32bits.iso application/x-cd-image (accuracy 100)
kali-linux-1.0.2-amd64.iso application/x-cd-image (accuracy 100)
kubuntu-13.04-beta1-desktop-amd64.iso application/x-cd-image (accuracy 100)
linuxmint-14-kde-dvd-64bit.iso application/x-cd-image (accuracy 100)
live-razorqt-20121023-i586.iso application/x-cd-image (accuracy 100)
Mandriva_Pulse_Demo_1.4.2.iso application/x-cd-image (accuracy 100)
maui-0.5.1-x86_64.iso application/x-cd-image (accuracy 100)
maui-0.5.1-x86.iso application/x-cd-image (accuracy 100)
MBS_1.0-soho.x86_64.iso application/x-cd-image (accuracy 100)
Minimal_Klyde.x86_64-0.1.2.iso application/x-cd-image (accuracy 100)
ocz_tools_316.iso application/x-cd-image (accuracy 100)
siduction-12.2.0-ridersonthestorm-rqt-amd64-201212092240.iso application/x-cd-image (accuracy 100)
SolusOS-amd64-1-2.iso application/x-cd-image (accuracy 100)
solydk64_201306.iso application/x-cd-image (accuracy 100)
trinity-rescue-kit.3.4-build-372.iso application/x-cd-image (accuracy 100)


So this is at least better then before, so should be pushed.
Comment 13 emrecio 2015-02-17 23:01:55 UTC
I had to up the weight here to 100 and comment out the wii/game cube xml to get it to work for me. Fedora 21 KDE 4.14.4 Dolphin 14.11.97
Comment 14 Bastien Nocera 2015-02-18 09:40:32 UTC
Your file manager is still broken though.

commit 824cff3da0f17812715795f0e64a47f7331a338b
Author: Bastien Nocera <hadess@hadess.net>
Date:   Wed Feb 18 10:37:36 2015 +0100

    Bump priority for ISO images glob matching
    
    To work-around file managers that cannot use magic to differentiate
    mime-types.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=80877
Comment 15 Roman Bysh 2015-02-18 22:20:10 UTC
Bastien

Thank you for accepting the patch.

As far as I can remember KDE Dolphin, Konqueror and MC have never used magic.
They always relied directly on shared-mime-info.
Comment 16 Bastien Nocera 2015-02-19 15:05:59 UTC
(In reply to Roman Bysh from comment #15)
> Bastien
> 
> Thank you for accepting the patch.
> 
> As far as I can remember KDE Dolphin, Konqueror and MC have never used magic.
> They always relied directly on shared-mime-info.

shared-mime-info is the one providing the magic...
Comment 17 Roman Bysh 2015-02-19 20:22:11 UTC
I'll submit a new bug report on kdelibs and Dolphin for them to look into.

Can you backport this patch into shared-mime-info 1.4 or do we wait for 1.5?
Comment 18 Bastien Nocera 2015-02-23 10:11:47 UTC
(In reply to Roman Bysh from comment #17)
> I'll submit a new bug report on kdelibs and Dolphin for them to look into.
> 
> Can you backport this patch into shared-mime-info 1.4 or do we wait for 1.5?

You should ask your distribution, using that distribution's channels.
Comment 19 Roman Bysh 2015-02-23 21:07:26 UTC
Yes. It has already been patched and provided for download.

I used "mc" (midnight commander) to view the openSUSE ISO for Tumbleweed. 
The following was viewed at the beginning of the ISO:

<--- snip -----------------------------------------------------
CD-ROM is in ISO 9660 format
System id: LINUX
Volume id: openSUSE-Tumbleweed-DVD-x86_6400
Volume set id:
Publisher id: SUSE LINUX GmbH
Data preparer id: KIWI - http://opensuse.github.com/kiwi
Application id: openSUSE-Tumbleweed-DVD-x86_64-Build0002-Media
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 2257732
El Torito VD version 1 found, boot catalog is in sector 20
Joliet with UCS level 3 found
Rock Ridge signatures version 1 found
Eltorito validation header:
    Hid 1
    Arch 0 (x86)
    ID 'SUSE LINUX GmbH'
    Key 55 AA
<--- snip -----------------------------------------------------

Does the Eltorito validation header key "55 AA" provide additional information to identify this iso? Can it be added?

When using GNOME's Nautilus filemanager. Does it use magic to differentiate mime-types?
Comment 20 Roman Bysh 2015-02-23 21:16:10 UTC
Created attachment 113771 [details]
ISO viewed in midnight commander
Comment 21 Roman Bysh 2015-02-23 21:18:14 UTC
Created attachment 113772 [details]
openSUSE ISO with Preferences viewed in Dolphin using KDE4.14.4
Comment 22 Roman Bysh 2015-02-23 21:21:43 UTC
Created attachment 113773 [details]
Correct upload of openSUSE ISO
Comment 23 Roman Bysh 2015-02-26 23:53:30 UTC
Created attachment 113849 [details]
ISO png file viewed in midnight commander
Comment 24 Roman Bysh 2015-05-17 00:59:36 UTC
I have kept our Bugzilla apprised of the date of your patch. 
Our "shared-mime-info" package was available several days after your patch was applied to the shared-mime-info master.

The openSUSE 13.2 update version number is shown below:  
shared-mime-info 1.4-2.4.1 rpm package

Build date:  Fri 20 Feb 2015 07:55:28 AM EST

I would recommend to users still experiencing this problem to check their distro for an update. It should have been available in the first quarter of 2014.

Or you can manually add this line below to the x-cd-image entry to the file freedesktop.org.xml.

 <glob weight="80" pattern="*.iso"/>
 <glob pattern="*.iso9660"/>
</mime-type>

In openSUSE 13.2 and Tumbleweed:
The file name can be found in /usr/share/mime/packages/freedesktop.org.xml

Note: 
Depending on the distro a slightly different file name may be used.
Comment 25 David Faure 2015-09-28 21:27:34 UTC
Bastien: you say "There is a conflict. The file manager is supposed to use the magic to differentiate the mime-types.".

My code in Qt and KDE certainly does that, as per the spec.

The problem is, there is no magic for application/x-cd-image.

So what should we do in such a case?

Sounds like Nautilus will reject the other two candidates because their magic doesn't match, and then fallback to the mimetype without magic?

That seems to be against the spec, which says

"...start by doing a glob match of the filename. Keep only globs with the
biggest weight. [...] If the glob matching fails or results in multiple
conflicting mimetypes, read the contents of the file and do magic sniffing on
it. If no magic rule matches the data (or if the content is not available), use
the default type of application/octet-stream for binary data, or text/plain for
textual data. [...]"

We are in the "no magic rule matches" case here, aren't we?

As Frank Reininghaus analysed in KDE bug 337035:

1. It looks like KDE software does *exactly* what the spec demands. 

2. The commit
http://cgit.freedesktop.org/xdg/shared-mime-info/commit/?id=4b0bc62b3e50f25d0ef42950e0b715274637c548,
which added the other mime types for the *.iso pattern, is broken, because it made detecting the 
application/x-cd-image type impossible for any application that follows the spec.

3. The "fix"
http://cgit.freedesktop.org/xdg/shared-mime-info/commit/?id=824cff3da0f17812715795f0e64a47f7331a338b
is equally broken, because it makes detecting the "new" mime types application/x-wii-rom and application/x-gamecube-rom impossible for any application that follows the spec.

4. The correct solution for the *.iso issue would be to give all types the same glob weight and, most importantly, also "magic" patterns that can be used to detect them, including application/x-cd-image.

It seems you rejected that idea in https://bugs.freedesktop.org/show_bug.cgi?id=10049   - time to revisit it?
Comment 26 Bastien Nocera 2018-06-17 09:57:27 UTC
(In reply to David Faure from comment #25)
> Bastien: you say "There is a conflict. The file manager is supposed to use
> the magic to differentiate the mime-types.".
> 
> My code in Qt and KDE certainly does that, as per the spec.
> 
> The problem is, there is no magic for application/x-cd-image.

FWIW. This bug is most likely a dupe of bug 97372. The bug only happened in Qt's implementation (and the reference implementation).
Comment 27 Bastien Nocera 2018-06-17 09:57:35 UTC
*** Bug 106936 has been marked as a duplicate of this bug. ***
Comment 28 GitLab Migration User 2018-10-13 10:40:51 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/shared-mime-info/issues/74.


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.